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.

I've got an Ubuntu 10.04 server with this configuration:

eth0: 192.168.10.XXX mask 255.255.255.0 gw 192.168.10.254
eth1: 192.168.0.XXX mask 255.255.255.0 gw 192.168.0.3

eth0 is used for incoming and outgoing trafic (internal webserver)
eth1 i want to use for accessing the network: 192.168.51.0/24 by gateway 192.168.0.1

when eth1 is down, the webserver is reachable.

When i want to bring the state of eth1 to up, i use the following commands:

$ sudo su
# ifconfig eth1 up
# route add -net 192.168.51.0 netmask 255.255.255.0 gw 192.168.0.1
# ping 192.168.51.XXX
[i've got contact]

# ip route add default via 192.168.10.254
# ping 192.168.51.XXX
[i've got contact]

but when i want to access the webserver, i can't get contact.

Can someone please give me some advice so the network .51 AND the webserver (network .10) is reachable?

share|improve this question
    
How are the reply packets the webserver sends supposed to get back to this server? It sounds like you've done half the job -- making this machine send the outbound ping packets to 192.168.0.1, but what about the second half -- making the web server send the ping reply packets back along the correct path? –  David Schwartz Oct 23 '12 at 7:23
    
ping result from local: ping 192.168.10.2: 100% packet loss ping 192.168.0.237: 0% packet loss ping result from server: ping 192.168.10.254: 0% packet loss ping 192.168.0.3: 0% packet loss ping 192.168.0.1: 0%packet loss ping 192.168.51.100: 0% packet loss –  Falco van Dooremolen Oct 23 '12 at 7:47
    
Please provide the output of ip route and ip addr when both interfaces are up. What IP are you trying to access the webserver from? –  mgorven Oct 23 '12 at 18:58

1 Answer 1

I've got the solution!

The command i had executed was:

# route del -net 192.168.0.0 netmask 255.255.255.0 eth1

After that command my: 0 network, 10 network AND 51 network was accessible.
I also edit /etc/sysctl.conf and uncomment net.ipv4.ip_forward=1 before, but i'm not sure if this is necessary.

my configs:

ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:0c:29:e0:03:9c  
          inet addr:192.168.10.2  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee0:39c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:53794 errors:0 dropped:0 overruns:0 frame:0
          TX packets:53916 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6812117 (6.8 MB)  TX bytes:21573511 (21.5 MB)

eth0:1    Link encap:Ethernet  HWaddr 00:0c:29:e0:03:9c  
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth1      Link encap:Ethernet  HWaddr 00:0c:29:e0:03:a6  
          inet addr:192.168.0.237  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee0:3a6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:29845 errors:0 dropped:0 overruns:0 frame:0
          TX packets:469 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2555869 (2.5 MB)  TX bytes:42872 (42.8 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8157 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8157 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:624350 (624.3 KB)  TX bytes:624350 (624.3 KB)

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.51.0    192.168.0.1     255.255.255.0   UG    0      0        0 eth1
192.168.10.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    0      0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    100    0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    100    0        0 eth0

/etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static 
address 192.168.10.2
netmask 255.255.255.0
gateway 192.168.10.254

auto eth0:1
iface eth0:1 inet static
address 192.168.10.10
netmask 255.255.255.0
gateway 192.168.10.254

auto eth1
iface eth1 inet static
address 192.168.0.237
netmask 255.255.255.0
gateway 192.168.0.1
post-up route add -net 192.168.51.0 netmask 255.255.255.0 gw 192.168.0.1 
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.