Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Number of NIC card of my desktop = 2.

eth0: 10.255.2.191
netmask 255.255.255.0
default gateway 10.255.2.1
broadcast 255.255.255.0

I have bought a switch and want to provide Internet service to another 4 desktops. My PC will act as router. I have configured the /etc/network/interfaces file.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.255.2.191
netmask 255.255.255.0
network 10.255.2.0
broadcast 10.255.2.255
gateway 10.255.2.1

auto eth1
iface eth1 inet static
address 192.168.0.9
netmask 255.255.255.248
broadcast 192.168.0.15
gateway 10.255.2.1 
up route add -net 192.168.0.8/29 gw 10.255.2.1 dev eth1

Host Desktop: There are 4 host desktops. One of host desktop configuration is given below:

auto lo
iface lo inet loopback

auto eth0 
iface eth0 inet static

address 192.168.0.10
network 192.168.0.8
netmask 255.255.255.248
gateway 192.168.0.9  

But Host desktop cannot connect to Internet. What should I do?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

1) Your dekstop's network settings are wrong, the gateway should only be defined for the eth0 interface, and the line route add -net 192.168.0.8/29 gw 10.255.2.1 dev eth1 just doesn't make any sense at all: the computer already has a route to the 192.168.0.8/29 network, as it's directly connected to one of its NICs.

2) You need to enable IP forwarding in the desktop, and also configure IPTABLES to allow routing. Depending on your desktop's current configuration, these steps might be needed or not.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.