ip addr查看本地的网段
[root@localhost ~]$ ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:5c:33:98 brd ff:ff:ff:ff:ff:ff
inet 192.168.126.180/24 brd 192.168.126.255 scope global noprefixroute dynamic ens33
主要看ens33配置
编辑网卡文件
vim /etc/sysconfig/network-scripts/ifcfg-ens33
#dhcp改为static
BOOTPROTO="static"
#开机启用本配置
ONBOOT="yes"
#静态IP
IPADDR=192.168.126.156
#默认网关
GATEWAY=192.168.126.255
#子网掩码
NETMASK=255.255.255.0
重启网卡
service network restart
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)