系统相关
首页 > 系统相关> > ubuntu18.04_server配置静态IPv4

ubuntu18.04_server配置静态IPv4

作者:互联网

ifconfig
返回如下:
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.19  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a00:27ff:fe48:cd59  prefixlen 64  scopeid 0x20<link>
        inet6 2408:8207:7899:3330:a00:27ff:fe48:cd59  prefixlen 64  scopeid 0x0<global>
        ether 08:00:27:48:cd:59  txqueuelen 1000  (Ethernet)
        RX packets 7388  bytes 10431679 (10.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1812  bytes 185665 (185.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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  (Local Loopback)
        RX packets 120  bytes 9880 (9.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 120  bytes 9880 (9.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sudo vim /etc/netplan/*.yaml
编辑enp0s3这块网卡的yaml

vim内容如下

network:
  ethernets:
    enp0s3:
      dhcp4: false
      addresses: [192.168.1.19/24]
      gateway4: 192.168.1.1
      nameservers:
              addresses: [119.29.29.29]
  version: 2
sudo netplan
ifconfig 查看是否修改成功

标签:errors,TX,bytes,RX,192.168,server,overruns,IPv4,ubuntu18.04
来源: https://www.cnblogs.com/liuer-mihou/p/16201709.html