Tip & Tech

동일서버에 서로 다른 2개대역 ip 사용하기

event2018-11-23 1221 views

[root@localhost ~]# ip route show table 1

[root@localhost ~]# ip route show table 2

#출력되는게 없어야 합니다.

[root@localhost ~]# ip rule show
0:    from all lookup local 
32766:    from all lookup main 
32767:    from all lookup default
# 기본 룰만 확인 됩니다.

#routing 추가

# ip route add 10.10.10.0/24 dev enp1s0f0 table 1

# ip route add default via 10.10.10.1 table 1

# ip route add 10.10.20.0/24 dev enp1s0f1 table 2

# ip route add default via 10.10.20.1 table 1

#ip rule add from 10.10.10.2/32 table 1 priority 100

# ip rule add from 10.10.20.2/32 table 2 priority 110

# ip route flush cache

확인

# ip rule show
0:      from all lookup local
100:    from 10.10.10.2 lookup 1
110:    from 10.10.20.2 lookup 2
32766:  from all lookup main
32767:  from all lookup default

# tcpdump -nni enp1s0f0 icmp -c 5

# tcpdump -nni enp1s0f1 icmp -c 5

클립보드에 복사되었습니다.