1. 수동 라우팅 테이블 추가

- 수동으로 라우팅 테이블을 추가할 경우는 시스템을 리부팅할 때 재 설정해야 한다

route add {-host|-net} Target[/prefix] [gw Gw] [dev]
route del {-host|-net} Target[/prefix] [gw Gw] [dev]
[root@localhost ~]# route add -net 192.168.10.0/24 gw 192.168.0.1 dev eth1
[root@localhost ~]# route add -host 192.168.20.100 gw 192.168.0.1 dev eth1


2. 부팅시 자동 활성화 되도록 라우팅 테이블 추가

- 아래와 같이 두가지 형식으로 설정파일에 추가 할 수 있다

[root@localhost ~]# cat /etc/sysconfig/network-scripts/route-eth1
192.168.10.0/24 via 192.168.0.1
192.168.20.100 via 192.168.0.1

[root@localhost ~]# cat /etc/sysconfig/network-scripts/route-eth1
ADDRESS0=192.168.10.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.0.1
ADDRESS1=192.168.20.100
NETMASK1=255.255.255.255
GATEWAY1=192.168.0.1


3. Routing table 적용

- 수동으로 라우팅 테이블을 추가한 경우는 route 명령으로 바로 확인이 가능하다
설정파일에 추가한 경우는 network 데몬을 리스타트 하거나 /etc/sysconfig/network-scripts 디렉토리안에 있는 ifup-routes 명령을 사용한다.

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ./ifup-routes eth1


4. Routing table 확인

- route 명령 또는 route -n 으로 확인

[root@localhost ~]# 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
192.168.10.0 192.168.0.1 255.255.255.0 U 0 0 0 eth1
192.168.20.100 192.168.0.1 255.255.255.255 U 0 0 0 eth1
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 192.168.32.2 0.0.0.0 UG 0 0 0 eth0



==============================================================
추가 : route add -net xxx.xx.0.. netmask 255.255.255.0 dev eth0
삭제 : route del -net xxx.xxx.xxx.xxx netmask 255.255.255.0


'System > Linux OS ' 카테고리의 다른 글

Linux LVM  (0) 2015.08.12
[tip] tmpdump ipv4 ipv6 모드변경  (0) 2015.05.01
[Linux] 리눅스 모니터링  (0) 2015.04.22
[ubuntu] 디스크 늘리기(ESXi기반의 VM)  (0) 2015.04.21
[Linux] TUN/TAP  (0) 2015.04.21

+ Recent posts