Quote:
Originally Posted by ferrari
Yes, that is because eth0 is preferred and your default route is via eth0 as well. If you examine your routing table while eth0 is disconnected, you'll observe that there is no default route (for routing to external IP addresses). Addresses within the LAN (same network segment) can be reached because ARP is used.
You could add the gateway manually with
Code:
ip route add default via 192.168.1.254 dev eth1
*Note that you can only have one default gateway assigned at a time.
|
Thank you so much for your help. OK, so I suppose that in order to make both NICs work at the same time, it's not just enough to add a new default gateway with that command, is it? Do I need to use static routing?
After some research, I have decided to change the network configuration and implement static routing. This is the new configuration (that still doesn't work):
Code:
eth0: IP: 192.168.7.228
Mask: 255.255.255.0
GW: 192.168.7.254
eth1 IP: 10.10.70.38
Mask: 255.255.255.0
GW: 10.10.70.254 (no Internet connected, just for local access).
First I created a new table "admin" in rt_tables. Then I added the new interface to the table:
Code:
ip route add 10.10.70.0/24 dev eth1 src 10.10.70.38 table admin
ip route add default via 10.10.70.254 dev eth1 table admin
I added the new rules:
Code:
ip rule add from 10.10.70.38/32 table admin
ip rule add to 10.10.70.38/32 table admin
And finally I made a flush of the cache.
However, the situation is the same. On the one hand, I can't access the Internet (I suppose that the cause is that it uses as default the GW of eth1 that is not connected to the Internet, I've tried to replace it using the previous one, but it says 'Error: either "to" is duplicate, or "eth0" is a garbage.'). On the other hand, the ping is still one-sided (I can ping from eth1 to my computer, but no in reverse way -maybe because eth1 gets the ping, but then sends response using eth0?).
I show the new network info:
Code:
[root@localhost ~]# ip route
10.10.70.0/24 dev eth1 proto kernel scope link src 10.10.70.38
192.168.0.0/21 dev eth0 proto kernel scope link src 192.168.7.228
169.254.0.0/16 dev eth0 scope link metric 1002
169.254.0.0/16 dev eth1 scope link metric 1003
default via 10.10.70.254 dev eth1
Code:
[root@localhost ~]# ip rule show
0: from all lookup local
32764: from all to 10.10.70.38 lookup main
32765: from 10.10.70.38 lookup main
32766: from all lookup main
32767: from all lookup default
Code:
ifconfig
eth0 Link encap:Ethernet HWaddr 00:1A:92:DB:04:B2
inet addr:192.168.7.228 Bcast:192.168.7.255 Mask:255.255.248.0
inet6 addr: fe80::21a:92ff:fedb:4b2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:55928 errors:0 dropped:0 overruns:0 frame:0
TX packets:1889 errors:0 dropped:0 overruns:0 carrier:2
collisions:0 txqueuelen:1000
RX bytes:4829639 (4.6 MiB) TX bytes:411318 (401.6 KiB)
eth1 Link encap:Ethernet HWaddr 10:FE:ED:02:94:E6
inet addr:10.10.70.38 Bcast:10.10.70.255 Mask:255.255.255.0
inet6 addr: fe80::12fe:edff:fe02:94e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:691 errors:0 dropped:0 overruns:0 frame:0
TX packets:889 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:220930 (215.7 KiB) TX bytes:206928 (202.0 KiB)
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:65536 Metric:1
RX packets:478 errors:0 dropped:0 overruns:0 frame:0
TX packets:478 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:201190 (196.4 KiB) TX bytes:201190 (196.4 KiB)
Regards