본문 바로가기

OS 관련 지식/리눅스(Linux)

[리눅스] default route 추가 방법

* default route 추가 방법

 

* route 테이블 확인

[root@Serome ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
1**.2**.0.0 * 255.255.0.0 U 0 0 0 eth0
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0

 

 

* default route 추가 / 삭제

route add default gw [default gateway] dev [인터페이스명]

route del default gw [default gateway] dev [인터페이스명]

 

ex) route add default gw 192.168.0.1 dev eth0

     route del default gw 192.168.0.1 dev eth0

 

 

* routing table 추가 / 삭제

route add -net [ip주소] netmask [netmask 주소] dev [인터페이스명]

route del -net [ip주소] netmask [netmask 주소] dev [인터페이스명]

 

ex) route add -net 192.168.40.0 netmask 255.255.255.0 dev eth0

    route del -net 192.168.40.0 netmask 255.255.255.0 dev eth0