sudo nmcli con mod "Wired connection 1" ipv4.addresses 192.168.1.100/24 sudo nmcli con mod "Wired connection 1" ipv4.gateway 192.168.1.1 sudo nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8 8.8.4.4" sudo nmcli con mod "Wired connection 1" ipv4.method manual sudo nmcli con up "Wired connection 1"
配置完成可查看网卡接口状态
1 2 3 4 5 6 7
$ nmcli connection show
NAME UUID TYPE DEVICE Wired connection 1 55408542-fe20-31ac-a17a-6f0902b46c36 ethernet enp0s20f0u5u3 docker0 9010b240-3f39-4f57-a1ba-bcf65ca8088c bridge docker0 lo 71c8839f-e1eb-4426-a641-e437bd21b803 loopback lo Mihomo 7ea9c1e7-8866-4e9a-9502-57b9ffe2a7a0 tun Mihomo
$ ip route show table all default dev Mihomo table 2022 default via 192.168.78.26 dev enp0s20f0u5u3 proto dhcp src 192.168.78.96 metric 20100 172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 192.168.78.0/24 dev enp0s20f0u5u3 proto kernel scope link src 192.168.78.96 metric 100 198.18.0.0/30 dev Mihomo proto kernel scope link src 198.18.0.1 local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1 local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1 broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1 local 172.17.0.1 dev docker0 table local proto kernel scope host src 172.17.0.1 broadcast 172.17.255.255 dev docker0 table local proto kernel scope link src 172.17.0.1 local 192.168.78.96 dev enp0s20f0u5u3 table local proto kernel scope host src 192.168.78.96 broadcast 192.168.78.255 dev enp0s20f0u5u3 table local proto kernel scope link src 192.168.78.96 local 198.18.0.1 dev Mihomo table local proto kernel scope host src 198.18.0.1 broadcast 198.18.0.3 dev Mihomo table local proto kernel scope link src 198.18.0.1 fe80::/64 dev vethccc5fa1 proto kernel metric 256 pref medium fe80::/64 dev docker0 proto kernel metric 256 pref medium fe80::/64 dev Mihomo proto kernel metric 256 pref medium fe80::/64 dev enp0s20f0u5u3 proto kernel metric 1024 pref medium local ::1 dev lo table local proto kernel metric 0 pref medium local fe80::42:2ff:febe:3ef0 dev docker0 table local proto kernel metric 0 pref medium local fe80::124:5d52:84b1:9870 dev Mihomo table local proto kernel metric 0 pref medium local fe80::1084:9eff:fe98:c06f dev vethccc5fa1 table local proto kernel metric 0 pref medium local fe80::36c8:e693:37ac:ab82 dev enp0s20f0u5u3 table local proto kernel metric 0 pref medium multicast ff00::/8 dev vethccc5fa1 table local proto kernel metric 256 pref medium multicast ff00::/8 dev docker0 table local proto kernel metric 256 pref medium multicast ff00::/8 dev enp0s20f0u5u3 table local proto kernel metric 256 pref medium multicast ff00::/8 dev Mihomo table local proto kernel metric 256 pref medium