我不确定为什么“ifconfig”命令没有显示我的 IP 地址,但我仍然可以访问同一网络中的其他主机。这种情况发生在我身上太多次了,我确实尝试搜索但没有成功解释它。它实际上确实显示在“ip addr”命令中。这些是我的静态 IP 地址配置,“ifconfig”和“ip addr”
这个是安装在物理服务器上的 ubuntu 版本 14.04。jessie/sid (Linux openstack 3.19.0-56-generic #62~14.04.1-Ubuntu SMP Fri Mar 11 11:03:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux)
太感谢了!
root@openstack:/home/stack# ip address list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
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
inet 169.254.169.254/32 scope link lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br100 state UP group default qlen 1000
link/ether 0c:c4:7a:76:1b:08 brd ff:ff:ff:ff:ff:ff
inet6 fe80::ec4:7aff:fe76:1b08/64 scope link
valid_lft forever preferred_lft forever
3: em2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 0c:c4:7a:76:1b:09 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether fa:26:3a:76:77:1c brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
5: br100: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 0c:c4:7a:76:1b:08 brd ff:ff:ff:ff:ff:ff
inet 10.11.12.1/24 brd 10.11.12.255 scope global br100
valid_lft forever preferred_lft forever
inet 192.168.20.46/24 brd 192.168.20.255 scope global br100
valid_lft forever preferred_lft forever
inet 192.168.20.49/32 scope global br100
valid_lft forever preferred_lft forever
inet6 fe80::8c2f:b6ff:fe58:4b11/64 scope link
valid_lft forever preferred_lft forever
10: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br100 state UNKNOWN group default qlen 500
link/ether fe:16:3e:88:1e:51 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc16:3eff:fe88:1e51/64 scope link
valid_lft forever preferred_lft forever
13: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br100 state UNKNOWN group default qlen 500
link/ether fe:16:3e:b4:69:7e brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc16:3eff:feb4:697e/64 scope link
valid_lft forever preferred_lft forever
17: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br100 state UNKNOWN group default qlen 500
link/ether fe:16:3e:b9:d7:4a brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc16:3eff:feb9:d74a/64 scope link
valid_lft forever preferred_lft forever
root@openstack:/home/stack# ifconfig
br100 Link encap:Ethernet HWaddr 0c:c4:7a:76:1b:08
inet addr:10.11.12.1 Bcast:10.11.12.255 Mask:255.255.255.0
inet6 addr: fe80::8c2f:b6ff:fe58:4b11/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:627132 errors:0 dropped:0 overruns:0 frame:0
TX packets:522836 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3074313781 (3.0 GB) TX bytes:308312132 (308.3 MB)
em1 Link encap:Ethernet HWaddr 0c:c4:7a:76:1b:08
inet6 addr: fe80::ec4:7aff:fe76:1b08/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2884361 errors:0 dropped:24125 overruns:0 frame:0
TX packets:816202 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3881966559 (3.8 GB) TX bytes:181453552 (181.4 MB)
Memory:fb200000-fb27ffff
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:45652477 errors:0 dropped:0 overruns:0 frame:0
TX packets:45652477 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:30760291923 (30.7 GB) TX bytes:30760291923 (30.7 GB)
virbr0 Link encap:Ethernet HWaddr fa:26:3a:76:77:1c
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vnet0 Link encap:Ethernet HWaddr fe:16:3e:88:1e:51
inet6 addr: fe80::fc16:3eff:fe88:1e51/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:487 errors:0 dropped:0 overruns:0 frame:0
TX packets:58390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:63154 (63.1 KB) TX bytes:4422625 (4.4 MB)
vnet1 Link encap:Ethernet HWaddr fe:16:3e:b4:69:7e
inet6 addr: fe80::fc16:3eff:feb4:697e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13333 errors:0 dropped:0 overruns:0 frame:0
TX packets:63555 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:1042620 (1.0 MB) TX bytes:29097792 (29.0 MB)
vnet2 Link encap:Ethernet HWaddr fe:16:3e:35:95:a0
inet6 addr: fe80::fc16:3eff:fe35:95a0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5086 errors:0 dropped:0 overruns:0 frame:0
TX packets:5567 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:450420 (450.4 KB) TX bytes:8912581 (8.9 MB)
root@openstack:/home/stack# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto em1
iface em1 inet static
address 192.168.20.46
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
gateway 192.168.20.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 8.8.8.8
答案1
ifconfig 已弃用。请参阅本文了解更多信息。 ifconfig 的现代版本是
ip address list