Ubuntu 22 OS Static ip Address Config
Step Command:
~$ ifconfig
enp3s0: flags = 409 9 < UP,BROADCAST,MULTICAST> mtu 1500
ether 8c:89:a5:0d:8c:cd txqueuelen 1000 ( 以太网)
RX packets 0 bytes 0 ( 0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 ( 0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19
lo: flags = 7 3 < UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0 .0.1 netmask 255.0 .0.0
inet6 ::1 prefixlen 128 scopeid 0x10 < host>
loop txqueuelen 1000 ( 本地环回)
RX packets 23059 bytes 2600338 ( 2.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 23059 bytes 2600338 ( 2.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp5s0: flags = 416 3 < UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168 .3.15 netmask 255.255 .255.0 broadcast 192.168 .3.255
inet6 fe80::260a:64ff:fe4a:8e78 prefixlen 64 scopeid 0x20 < link>
ether 24 :0a:64:4a:8e:78 txqueuelen 1000 ( 以太网)
RX packets 699778 bytes 798553920 ( 798.5 MB)
RX errors 0 dropped 3286 overruns 0 frame 0
TX packets 345079 bytes 54032986 ( 54.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
~$ route -n
~$ sudo vim /etc/netplan/01-network-manager-all.yaml
network:
version: 2
renderer: NetworkManager
wifis:
wlp5s0:
dhcp4: no
access-points:
"WI-FI NAME" :
password: "WI-FI PASSWORD"
addresses: [ 192.168 .3.10/24]
nameservers:
addresses: [ 8.8 .8.8, 114.114 .114.114]
routes:
- to: default
via: 192.168 .3.1
~$ sudo netplan apply
switch WI-FI connect to netplan-wlp5s0
check ip address config is right
PS: