查看服务器的内网及外网IP

       在公司开发项目时,配置文件中配置的IP地址都是公司内网地址,但是项目上线后发布的是外网地址,在一个公司,有可能有很多外网IP,那么如何能准确知道外网IP与内网IP的对应关系呢?

        其实特别简单,就一个命令:ip address,如下所示,可以看到,eth0所对应的是内网IP(10.90.100.88),而eth1所对应的IP为外网IP(192.168.58.66)

[root@itcast ~]# ip address
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:16:3e:06:db:bf brd ff:ff:ff:ff:ff:ff
    inet 10.90.100.88/22 brd xx.xx.xx.255 scope global eth0
       valid_lft forever preferred_lft forever
3: eth1:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:16:3e:08:14:6d brd ff:ff:ff:ff:ff:ff
    inet 192.168.58.66/22 brd xx.xxx.xx.255 scope global eth1
       valid_lft forever preferred_lft forever
[root@itcast ~]# 

 

你可能感兴趣的:(学习笔记)