- 论坛徽章:
- 0
|
freebsd下用ifconfig更改网卡ip地址后是否要重启动?
系统刚刚启动时,ip地址为192.168.0.21
- bsd# ifconfig vr0
- vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>; mtu 1500
- inet 10.0.6.21 netmask 0xffffff00 broadcast 10.0.6.255
- inet 192.168.0.21 netmask 0xffffff00 broadcast 192.168.0.255
- ether 00:05:5d:e2:e0:fa
- media: Ethernet autoselect (100baseTX <full-duplex>;)
- status: active
- bsd# ping -c 2 192.168.0.2
- PING 192.168.0.2 (192.168.0.2): 56 data bytes
- 64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 time=0.906 ms
- 64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.797 ms
- --- 192.168.0.2 ping statistics ---
- 2 packets transmitted, 2 packets received, 0% packet loss
- round-trip min/avg/max/stddev = 0.797/0.852/0.906/0.054 ms
复制代码
更改IP地址,将192.168.0.21改为192.168.0.3
- bsd# ifconfig vr0 192.168.0.21 delete
- bsd# ifconfig vr0 192.168.0.3/24 alias
- bsd# ifconfig vr0
- vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>; mtu 1500
- inet 10.0.6.21 netmask 0xffffff00 broadcast 10.0.6.255
- inet 192.168.0.3 netmask 0xffffff00 broadcast 192.168.0.255
- ether 00:05:5d:e2:e0:fa
- media: Ethernet autoselect (100baseTX <full-duplex>;)
- status: active
复制代码
为什么ping不通呢,是不是我改的方法不对?
- bsd# ping -c 2 192.168.0.2
- PING 192.168.0.2 (192.168.0.2): 56 data bytes
- ping: sendto: No route to host
- ping: sendto: No route to host
- ^C
- --- 192.168.0.2 ping statistics ---
- 2 packets transmitted, 0 packets received, 100% packet loss
复制代码 |
|