1)配置IP
编辑/etc/sysconfig/network-scripts/ifcfg-eth0(不同的网卡为ifcfg-eth?)
a)静态IP
- DEVICE=eth0
- HWADDR=00:0C:29:F3:13:87
- TYPE=Ethernet
- UUID=24b0bad9-c606-4498-a03a-65afa7d5ce63
- ONBOOT=yes
- NM_CONTROLLED=yes
- BOOTPROTO=static
- IPADDR=192.168.1.150
- NETMASK=255.255.255.0
- NETWORK=192.168.1.150
- GATEWAY=192.168.1.1
- DNS=xxx.xxx.xxx.xxx
b)动态IP
- DEVICE=eth0
- HWADDR=00:0C:29:F3:13:87
- TYPE=Ethernet
- UUID=24b0bad9-c606-4498-a03a-65afa7d5ce63
- ONBOOT=yes
- NM_CONTROLLED=yes
- BOOTPROTO=dbcp
2)重启IP服务
service network restart
时间: 2024-12-07 14:35:14