释放双眼,带上耳机,听听看~!
🤖 由 ChatGPT 生成的文章摘要
Ubuntu默认网卡名称为ens160
root@kafka2:~# 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 mq state UP group default qlen 1000
link/ether 00:0c:29:5e:76:48 brd ff:ff:ff:ff:ff:ff
altname enp3s0
inet 192.168.31.71/24 brd 192.168.31.255 scope global ens160
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe5e:7648/64 scope link
valid_lft forever preferred_lft forever
修改配置文件
#编辑/etc/default/grub
vim /etc/default/grub
#在GRUB_CMDLINE_LINUX后面添加net.ifnames=0 biosdevname=0
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
设置生效
update-grub
修改配置文件(下面是修改静态ip)
/etc/network/interfaces
auto eth0
iface eth0 inet static
address 10.10.10.201
network 255.255.255.0
gateway 10.10.10.1
dns-nameservers 10.10.10.1 114.114.114.114
接下来重启服务器
root@kafka2:~# reboot
重启完成后查看IP