PDA

View Full Version : eth0 and eth1 config not working


blunt
2nd December 2007, 19:49
I have two ethernet cards, both connected to the same router. I wanted one of the cards to have IP 192.168.1.10 (eth0) and the other to have 192.168.2.10 (eth1). I can access the server through ssh with both IPs, but if I turn off my eth0 (ifdown) I cannot access the server even with the IP of eth1. I don't understand why...

I will leave my ifconfig output as well as my route output.

[root@server ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:FC:3B:B8:44
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:fcff:fe3b:b844/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:951393 errors:0 dropped:0 overruns:0 frame:0
TX packets:738669 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:704824230 (672.1 MiB) TX bytes:128870361 (122.9 MiB)
Interrupt:217

eth1 Link encap:Ethernet HWaddr 00:13:D4:B9:FF:98
inet addr:192.168.2.10 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::213:d4ff:feb9:ff98/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4814 errors:0 dropped:0 overruns:0 frame:0
TX packets:368 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:397021 (387.7 KiB) TX bytes:18264 (17.8 KiB)
Interrupt:225 Base address:0xa000

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:729329 errors:0 dropped:0 overruns:0 frame:0
TX packets:729329 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:289483959 (276.0 MiB) TX bytes:289483959 (276.0 MiB)

venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:208930 errors:0 dropped:0 overruns:0 frame:0
TX packets:232110 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22217125 (21.1 MiB) TX bytes:95662039 (91.2 MiB)

[root@server ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.102 0.0.0.0 255.255.255.255 UH 0 0 0 venet0
192.168.1.101 0.0.0.0 255.255.255.255 UH 0 0 0 venet0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

Any hel is appreciated...

thank you

falko
3rd December 2007, 18:26
I guess it's a routing problem because eth0 and eth1 are in different subnets.
In what subnet is your client PC?

blunt
3rd December 2007, 20:14
my client PC has subnet 255.255.0.0

falko
4th December 2007, 21:47
That's the netmask. What IP address does your client PC have?

blunt
4th December 2007, 21:52
sorry i didn't understand your question right.
my client PC address is 192.168.1.236

falko
5th December 2007, 15:38
eth1 has 192.168.2.10 which is in a different subnet; that's why you can't connect to it when you disconnect eth0.

blunt
5th December 2007, 15:46
is there a way of getting it to work? the problem is that I had eth0 with ip 192.168.1.10 and eth1 with 192.168.1.20.

Then I noticed that even with the eth1 cable unplugged, I could access the server through eth0 with IP 192.168.1.20...when I posted this on another forum, someone told me to give an ip to eth1 from another subnet...

is there another way?

thavaht
5th December 2007, 16:41
Have a look in the following articles:
http://gentoo-wiki.com/HOWTO_add_a_static_route
or
http://qref.sourceforge.net/Debian/reference/ch-gateway.en.html