Rocky linux9 配置网卡

Rocky linux9 配置网卡

#编辑网卡,ens160是网卡名字
vi /etc/NetworkManager/system-connections/ens160.nmconnection

connection]
id=ens160
uuid=1e1529bf-0e33-3b5d-bd1e-7dc5e8174302
type=ethernet
autoconnect-priority=-999
interface-name=ens160
timestamp=1668440312

[ethernet]

[ipv4]
address1=192.168.0.113/24,192.168.0.254			#第一个是网卡IP后面的是网卡网关
dns=192.168.0.113;								#DNS配置
may-fail=false									#加上
method=manual

[ipv6]
addr-gen-mode=eui64
method=auto

[proxy]
~   
#保存并退出:wq
#然后直接连接机活重启网卡
nmcli c r ens160
nmcli c u ens160
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: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:72:77:2e brd ff:ff:ff:ff:ff:ff
    altname enp3s0
    inet 192.168.0.113/24 brd 192.168.0.255 scope global noprefixroute ens160
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe72:772e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

#这样就成功了

你可能感兴趣的:(Linux基础知识(小白必看),linux,服务器,网络)