* eth0:1 디바이스에 등록된 virtual ip address: 192.168.0.12 (실제 src ip 가 될 가상 address)
# ip -f inet -o addr
1: lo inet 127.0.0.1/8 scope host lo
2: eth0 inet 192.168.0.11/24 brd 192.168.0.255 scope global eth0
2: eth0 inet 192.168.0.12/24 brd 192.168.0.255 scope global secondary eth0:1
1. 라우팅 테이블등록
# vi /etc/sysconfig/network-scripts/route-eth0:1 <- 파일형식: route-[interface NAME]
58.58.58.58 via 192.168.0.1 src 192.168.0.12
각각의 인터페이스에 해당하는 라우팅테이블파일을 생성하여 위와 같이 추가합니다
2. 네트워크 서비스 재기동
# service network restart
3. 등록된 라우팅 테이블 확인 및 src ip 확인
[root@node1 network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
58.58.58.58 192.168.0.1 255.255.255.255 UGH 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
[root@node1 network-scripts]# ip route show
58.58.58.58 via 192.168.0.1 dev eth0 src 192.168.0.12
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.11
169.254.0.0/16 dev eth0 scope link
default via 192.168.0.1 dev eth0
4. 실제 패킷 감시 (src IP확인)
[root@node1 ~]# ping 58.58.58.58
[root@node1 ~]# tcpdump -ni eth0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
06:21:44.702173 IP 192.168.0.12 > 58.58.58.58: ICMP echo request, id 20745, seq 1, length 64
06:21:44.703152 IP 58.58.58.58 > 192.168.0.12: ICMP echo reply, id 20745, seq 1, length 64
06:21:45.700775 IP 192.168.0.12 > 58.58.58.58: ICMP echo request, id 20745, seq 2, length 64
06:21:45.701587 IP 58.58.58.58 > 192.168.0.12: ICMP echo reply, id 20745, seq 2, length 64
06:21:46.704602 IP 192.168.0.12 > 58.58.58.58: ICMP echo request, id 20745, seq 3, leng
'Linux > CentOS & RHEL' 카테고리의 다른 글
[Tip] 리눅스 시간변경(date -s) (0) | 2020.09.05 |
---|---|
[Tip] parted(2TB 이상 Disk 파티션) (0) | 2020.09.05 |
[Tip] firewalld vs iptables (0) | 2020.08.29 |
[Tip] iptables 설정 및 정책 적용 (0) | 2020.08.29 |
[Tip] CentOS 6.x / CentOS 7.x google-authenticator(google OTP) 설정 (0) | 2020.08.28 |