免费注册 查看新帖 |

Chinaunix

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

unix中更改IP地址,我该如何做? [复制链接]

论坛徽章:
0
1 [报告]
发表于 2005-12-29 10:49 |显示全部楼层
如只改IP,2个方法:

1。当时就生效的,但重起又没的,用ifconfig命令:

检查你的网口设备名称是哪个:

# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
eri0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.1.1.7 netmask ffffff00 broadcast 10.1.1.255
        ether 0:3:ba:16:e7:53

例如是叫eri0,则改该网口的IP:

# ifconfig eri0 10.1.1.6 netmask 255.255.255.0 up

# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
eri0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.1.1.6 netmask ffffff00 broadcast 10.1.1.255
        ether 0:3:ba:16:e7:53


2。永久的,改/etc/hosts, 改后重起:

# vi /etc/hosts

#
# Internet host table
#
127.0.0.1       localhost
10.1.1.7        bbs.chinaunix.net     loghost

# reboot
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP