Ubuntu 22 OS Static ip Address Config

Ubuntu 22 OS Static ip Address Config

Step Command:

  • look ip address
~$ ifconfig
enp3s0: flags=4099<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=73<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=4163<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
       
  • look gateway address
~$ route -n

在这里插入图片描述

  • edit config file
~$ sudo vim /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

  wifis:
    wlp5s0:
      dhcp4: no
      access-points:
        "WI-FI NAME": # must needed modify
          password: "WI-FI PASSWORD" # must needed modify 
      addresses: [192.168.3.10/24]
      nameservers:
        addresses: [8.8.8.8, 114.114.114.114] # not modify
      routes:
        - to: default
          via: 192.168.3.1 # must needed modify 

  • apply config

~$ sudo netplan apply

  • switch WI-FI connect to netplan-wlp5s0

在这里插入图片描述

  • check ip address config is right
    在这里插入图片描述

PS:

  • 10
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

唐·王惜之

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值