常见网卡设置
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
NAME=ens33
UUID=025f7880-7357-4148-ae5a-a629d597c133
DEVICE=ens33
ONBOOT=yes
DNS1=8.8.8.8
IPADDR= 192.168.100.16
GATEWAY=192.168.100.254
NETMASK=255.255.255.0
有的版本linux系统网卡启动不起来,此时需要默认设置,如下操作:
此时在ipv4,先设置手动,能连上网,然后输入 systemctl restart network指令,查当前ip,
[root@localhost admin]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:40:b0:61 brd ff:ff:ff:ff:ff:ff
inet6 fe80::20c:29ff:fe40:b061/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:60:08:9a brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:60:08:9a brd ff:ff:ff:ff:ff:ff
发现ip地址没有,此时关闭有线设置,如下
然后重启网卡, systemctl restart network,查ip a。如果还没出ip,重复关闭有线连接,命令行重启网卡,一直到有ip 位置