实验-修该网卡默认命名规则
vim /etc/default/grub
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
update-grub
shutdown -r now
实验-临时配置IP地址
ifconfig
ifconfig ens33 192.168.200.201/24
ifconfig
实验-IP地址的配置
systemctl restart NetworkManager
nmcli connection modify 有线连接 ipv4.method manual ipv4.addresses 192.168.200.201/24 ipv4.gateway 192.168.200.2 ipv4.dns 114.114.114.114
nmcli connection up 有线连接
实验-ipv6地址添加
nmcli connection modify 有线连接 ipv6.method manual ipv6.addresses 2001::1/64
nmcli connection down 有线连接
nmcli connection up 有线连接
ping6 2001::1
实验-多配置文件管理网卡
nmcli connection add type ethernet con-name home ifname ens34
nmcli connection modify ens34 ipv4.method manual ipv4.addresses "10.0.0.1/24 10.0.0.1" ipv4.dns 10.0.0.1
nmcli connection down ens34
nmcli connection up ens34
实验-新增网卡
新添加一块网卡
nmcli device show可以发现新增了一块网卡
nmcli connection add type ethernet enoxx ifname enoxx
nmcli connection modify enoxx ipv4.method manual ipv4.addresses "192.168.200.201/24 192.168.200.2" ipv4.dns 192.168.200.2 connection.autoconnect yes
systemctl restart NetworkManager
ifconfig
实验-路由设置
route -n
route add -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.200.2
route del -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.200.2
实验-通过配置文件修改地址
vim /etc/NetworkManager/system-connections/ens33.nmconnection
[connection]
id=ens33
uuid=295fe3c5-8646-3687-6241-259390fe3e3b
type=ethernet
interface-name=eth0
permissions=
timestamp=1586329658
[ethernet]
mac-address=00:0C:29:5F:D3:90
mac-address-blacklist=
[ipv4]
address1=192.168.200.201/24,192.168.200.2
dns=192.168.200.2;
dns-search=
may-fail=false
method=manual
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
ip6-privacy=0
method=auto
网友评论