贊助商連結

ifconfig 指令

by undefined

列出所有網路介面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# ifconfig
gem0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet 192.168.1.120 netmask 0xffffff00 broadcast 192.168.1.255
ether 00:02:11:90:03:9c
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
fwe0: flags=108802<BROADCAST,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500
options=8<VLAN_MTU>
ether 02:02:11:90:03:9c
ch 1 dma -1
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000

增加另外的 IP Address

1
2
3
4
5
6
7
8
9
10
# ifconfig em1 inet 192.168.0.10 alias
# ifconfig

gem0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet 192.168.1.120 netmask 0xffffff00 broadcast 192.168.1.255
inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255
ether 00:02:11:90:03:9c
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active

取消另外的 IP Address

1
2
3
4
5
6
7
8
9
# ifconfig gem0 inet 192.168.1.100 -alias
# ifconfig

gem0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet 192.168.1.120 netmask 0xffffff00 broadcast 192.168.1.255
ether 00:02:11:90:03:9c
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active


喜歡我們的文章可以按上面的 LIKE 給我們鼓勵喔!