linux设置静态ip
来源:互联网 发布:深圳垦鑫达对员工知乎 编辑:程序博客网 时间:2024/05/27 14:13
在使用linux虚拟机的时候因为经常有关机的需求,然后重新开机后可能面临这上一次获取的ip被改变,在这里我分享一下在linux
下设置静态ip的经验
1.查看路由状态
[root@localhost ~]# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface192.168.203.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0[root@localhost ~]#
Destination:目标网络或主机。
Gateway:网关地址。
Genmask:目标网络的网络掩码。"255.255.255.255"表示一个主机。"0.0.0.0"表示网关。
Flags:标记。
U、路由被启用。
H、目标是一个主机
G、使用网关。
详情请参考:http://www.cnblogs.com/dongzhiquan/archive/2012/12/26/2834904.html
2.修改网卡设置
可以零时修改:ifconfig eth0 ip地址
修改网卡配置文件并保存:
vim /etc/sysconfig/network-scripts/ifcfg-eth0
可以看到
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
#BOOTPROTO=dhcp
BOOTPROTO=static
ONBOOT=yes
HWADDR=00:0c:29:ed:44:80
修改配置文件
#cary
IPADDR=192.168.203.128
NETMASK=255.255.255.0
GETEWAY=192.168.203.1
注意:BOOTPROTO=static,要改为static方式
3.重启网卡
ifdown eth0ifup eth0
这样整个配置过程就完成了
0 0
- Linux设置静态IP
- Linux静态IP设置
- Linux静态IP设置
- Linux静态IP设置
- Linux静态IP设置
- Linux静态IP设置
- Linux静态IP设置
- linux 设置静态IP
- Linux静态IP设置
- linux设置静态ip
- linux 静态ip 设置
- Linux静态IP设置
- Linux设置静态ip
- Linux静态iP设置
- Linux静态IP设置
- linux静态ip设置
- Linux静态IP设置
- Linux 设置静态IP
- cron表达式详解
- Weighttp对Jetty做压力测试,长连接和短连接测试
- 部署maven的一些要点、遇到的问题
- 1.maven安装配置
- linux下的压缩命令
- linux设置静态ip
- 为Linux虚拟机设置网络
- msysgit解决中文乱码问题
- eclipse快捷键
- android 文件夹文件搜索
- Apache Commons configuration使用入门
- 安装mysql时启动服务出错问题
- ubuntu上mongodb的安装
- mongodb在windows下的安装