Configure dual NIC routing table

  
on Linux system. If eth0 is 192.168.10.123/255.255.255.0 and eth1 is 192.168.20.231/255.255.255.0, the command format is as follows:

#route add -net 192.168.10.0 Netmask 255.255.255.0 dev eth0

#route add -net 192.168.20.0 netmask 255.255.255.0 dev eth1

The above command forwards the IP packet sent to the 192.168.10.0 network segment to eth0. , the IP packet of the 192.168.20.0 network segment is forwarded to eth1 for forwarding. If there is still a possibility to send a packet to another destination IP, then you can want to set a "default gateway":

#route add default gw 192.168.10.1

The above command puts all Packets sent to other destination IPs are forwarded to 192.168.10.1, and the rules for forwarding to the 192.168.10.1 address have been defined in the first command (for forwarding from eth0). Under normal circumstances, the default gateway has been automatically set, no need to repeat settings. You can check it with the route command plus the -n parameter.

If you want to delete a certain item, the command format is:

#route del -net 192.168.10.0 netmask 255.255.255.0

One way of configuration is to put 192.168. The 10.0 network segment is routed to eth0, and the 192.168.20.0 network segment is routed to eth1, and then the default route is set. Another idea is to specify only one of them and then route the default 0.0.0.0 to another. In fact, the effect is the same, it is two styles.
Copyright © Windows knowledge All Rights Reserved