route del default route add default gw 172.20.10.1 route add 130.80.10.185 gw 192.168.0.1 route add 130.68.49.35 gw 192.168.0.1 root@debian:~# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.43.1 0.0.0.0 UG 0 0 0 wlan0 130.80.10.185 192.168.nate.co 255.255.255.255 UGH 0 0 0 eth0 link-local * 255.255.0.0 U 1000 0 0 wlan0 192.168.0.0 * 255.255.255.0 U 0 0 0 eth0 192.168.43.0 * 255.255.255.0 U 0 0 0 wlan0
——————————————————————————–
U : 활성화중
G : 게이트웨이 설정중
H : 호스트 대상
——————————————————————————–
# 130.68.41.0 네트워크 영역에 대해서 패킷이 나가는 GW를 192.168.0.1로 지정한다는 의미
sudo route add -net 130.68.41.0 netmask 255.255.255.0 gw 192.168.0.1
user1@webterror:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 172.20.10.1 0.0.0.0 UG 0 0 0 wlan0 130.68.41.0 192.168.0.1 255.255.255.0 UG 0 0 0 eth0 130.80.10.185 192.168.0.1 255.255.255.255 UGH 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0 172.20.10.0 0.0.0.0 255.255.255.240 U 2 0 0 wlan0 192.168.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
root@debian:~# netstat -anr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0 echo "1 admin" >> /etc/iproute2/rt_tables ip route add 192.168.0.0/24 dev eth0 src 192.168.0.44 table admin ip route list table admin root@debian:~# ifconfig eth0 Link encap:Ethernet HWaddr 60:eb:69:88:6d:e5 inet addr:192.168.0.44 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::62eb:69ff:fe88:6de5/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:178704 errors:0 dropped:493 overruns:0 frame:0 TX packets:51972 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:24565172 (23.4 MiB) TX bytes:4149861 (3.9 MiB) Interrupt:42 Base address:0xe000 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:6697 errors:0 dropped:0 overruns:0 frame:0 TX packets:6697 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1228216 (1.1 MiB) TX bytes:1228216 (1.1 MiB) wlan0 Link encap:Ethernet HWaddr 20:7c:8f:4b:e4:92 inet addr:192.168.43.112 Bcast:192.168.43.255 Mask:255.255.255.0 inet6 addr: fe80::227c:8fff:fe4b:e492/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:33385 errors:0 dropped:0 overruns:0 frame:0 TX packets:29834 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:29576215 (28.2 MiB) TX bytes:4271975 (4.0 MiB)