본문 바로가기
OS-OE Knowledge/Linux-Unix KB

How realize Gateway of current Network

by 스쳐가는인연 2018. 9. 21.

현 네트워크의 Gateyway 알아내기

 

route 명령은 Kernel 버전에 따라 정보를 제대로 보여주지 못함.

버전에 관계 없이, "netstat -rn" 또는 "ip route"를 통해 확인이 가능함

 

RHEL 7.5

# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.171.6.1      0.0.0.0         UG        0 0          0 eno1
192.171.6.0      0.0.0.0         255.255.254.0   U         0 0          0 eno1
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eno1
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0

 

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    0      0        0 eno1
192.171.6.0      0.0.0.0         255.255.254.0   U     0      0        0 eno1
link-local      0.0.0.0         255.255.0.0     U     1002   0        0 eno1
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

 

# ip route
default via 192.171.6.1 dev eno1
192.171.6.0/23 dev eno1 proto kernel scope link src 192.171.6.28
169.254.0.0/16 dev eno1 scope link metric 1002
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1

 

RHEL 6.7
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.54.72.0      *               255.255.248.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0
default         10.54.79.254    0.0.0.0         UG    0      0        0 eth0

# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.54.72.0      0.0.0.0         255.255.248.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.54.79.254    0.0.0.0         UG        0 0          0 eth0


# ip route
192.54.72.0/21 dev eth0  proto kernel  scope link  src 192.54.72.112
169.254.0.0/16 dev eth0  scope link  metric 1002
default via 192.54.79.254 dev eth0


 

반응형