免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 10575 | 回复: 22
打印 上一主题 下一主题

[FreeBSD] freebsd下用ifconfig更改网卡ip地址后是否要重启动? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-06-29 20:32 |只看该作者 |倒序浏览
不退出多用户模式能立即生效吗?

论坛徽章:
0
2 [报告]
发表于 2003-06-29 20:34 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
3 [报告]
发表于 2003-06-29 20:49 |只看该作者

freebsd下用ifconfig更改网卡ip地址后是否要重启动?

可是我更改IP后就ping不通外部了.这是怎么回事啊?

论坛徽章:
0
4 [报告]
发表于 2003-06-29 20:55 |只看该作者

freebsd下用ifconfig更改网卡ip地址后是否要重启动?

系统刚刚启动时,ip地址为192.168.0.21

  1. bsd# ifconfig vr0
  2. vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>; mtu 1500
  3.         inet 10.0.6.21 netmask 0xffffff00 broadcast 10.0.6.255
  4.         inet 192.168.0.21 netmask 0xffffff00 broadcast 192.168.0.255
  5.         ether 00:05:5d:e2:e0:fa
  6.         media: Ethernet autoselect (100baseTX <full-duplex>;)
  7.         status: active

  8. bsd# ping -c 2 192.168.0.2
  9. PING 192.168.0.2 (192.168.0.2): 56 data bytes
  10. 64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 time=0.906 ms
  11. 64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.797 ms

  12. --- 192.168.0.2 ping statistics ---
  13. 2 packets transmitted, 2 packets received, 0% packet loss
  14. round-trip min/avg/max/stddev = 0.797/0.852/0.906/0.054 ms
复制代码


更改IP地址,将192.168.0.21改为192.168.0.3

  1. bsd# ifconfig vr0 192.168.0.21 delete
  2. bsd# ifconfig vr0 192.168.0.3/24 alias
  3. bsd# ifconfig vr0
  4. vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>; mtu 1500
  5.         inet 10.0.6.21 netmask 0xffffff00 broadcast 10.0.6.255
  6.         inet 192.168.0.3 netmask 0xffffff00 broadcast 192.168.0.255
  7.         ether 00:05:5d:e2:e0:fa
  8.         media: Ethernet autoselect (100baseTX <full-duplex>;)
  9.         status: active
复制代码

为什么ping不通呢,是不是我改的方法不对?

  1. bsd# ping -c 2 192.168.0.2
  2. PING 192.168.0.2 (192.168.0.2): 56 data bytes
  3. ping: sendto: No route to host
  4. ping: sendto: No route to host
  5. ^C
  6. --- 192.168.0.2 ping statistics ---
  7. 2 packets transmitted, 0 packets received, 100% packet loss
复制代码

论坛徽章:
0
5 [报告]
发表于 2003-06-29 21:11 |只看该作者

freebsd下用ifconfig更改网卡ip地址后是否要重启动?

直接该即可
不用del也不用alias
#ifconfig vr0 192.168.0.3/24 up

论坛徽章:
0
6 [报告]
发表于 2003-06-29 21:15 |只看该作者

freebsd下用ifconfig更改网卡ip地址后是否要重启动?

还是不行啊.

  1. bsd# ifconfig vr0 192.168.0.3 up
  2. bsd# ping 192.168.0.2
  3. PING 192.168.0.2 (192.168.0.2): 56 data bytes
  4. ping: sendto: No route to host
  5. ping: sendto: No route to host
  6. ^C
  7. --- 192.168.0.2 ping statistics ---
  8. 2 packets transmitted, 0 packets received, 100% packet loss
  9. bsd#
复制代码

论坛徽章:
0
7 [报告]
发表于 2003-06-29 21:20 |只看该作者

freebsd下用ifconfig更改网卡ip地址后是否要重启动?

先ifconfig vr0 down
在ifconfig vr0 192.168.0.3/24 up

论坛徽章:
0
8 [报告]
发表于 2003-06-29 21:27 |只看该作者

freebsd下用ifconfig更改网卡ip地址后是否要重启动?

还是ping不通.如果再改回启动时的IP就能通。不知道怎么回事.

  1. bsd# ifconfig vr0 down
  2. bsd# ifconfig vr0 192.168.0.3/24 up
  3. bsd# ping 192.168.0.2
  4. PING 192.168.0.2 (192.168.0.2): 56 data bytes
  5. ping: sendto: No route to host
  6. ^C
  7. --- 192.168.0.2 ping statistics ---
  8. 1 packets transmitted, 0 packets received, 100% packet loss
复制代码

如果改成启动时的IP就能通.

  1. bsd# ifconfig vr0 192.168.0.21/24 up
  2. bsd# ping 192.168.0.2
  3. PING 192.168.0.2 (192.168.0.2): 56 data bytes
  4. 64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 time=2.382 ms
  5. 64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.829 ms
  6. ^C
  7. --- 192.168.0.2 ping statistics ---
  8. 2 packets transmitted, 2 packets received, 0% packet loss
  9. round-trip min/avg/max/stddev = 0.829/1.606/2.382/0.776 ms
  10. bsd#
复制代码

论坛徽章:
0
9 [报告]
发表于 2003-06-29 21:33 |只看该作者

freebsd下用ifconfig更改网卡ip地址后是否要重启动?

ping: sendto: No route to host  ?
把你改之前,改之后的
#netstat -nr
贴出来

论坛徽章:
0
10 [报告]
发表于 2003-06-29 21:47 |只看该作者

freebsd下用ifconfig更改网卡ip地址后是否要重启动?

都一样啊
这是系统启动时的(通的)

  1. bsd# netstat -rn
  2. Routing tables

  3. Internet:
  4. Destination        Gateway            Flags    Refs      Use  Netif Expire
  5. 127.0.0.1          127.0.0.1          UH          2      354    lo0
  6. 192.168.0          link#1             UC          1        0    vr0
  7. bsd#
复制代码

这是改成192.168.0.3时的(不通的)

  1. bsd# netstat -rn
  2. Routing tables

  3. Internet:
  4. Destination        Gateway            Flags    Refs      Use  Netif Expire
  5. 127.0.0.1          127.0.0.1          UH          2      354    lo0
  6. 192.168.0          link#1             UC          0        0    vr0
  7. bsd#
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP