天天看點

ubuntu18系統修改ip、單網卡配置多ip

打開IP位址配置檔案

配置資訊如下:

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      dhcp4: no
      addresses: [192.168.206.100/24]
      gateway4: 192.168.206.1
      nameservers:
       addresses: [ 8.8.8.8 ]
  version: 2
           

儲存退出并重新開機網卡

檢視修改ip是否生效

ip a 或者ifconfig

[email protected]:~# ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.206.100  netmask 255.255.255.0  broadcast 192.168.206.255
        inet6 fe80::20c:29ff:fe26:418  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:26:04:18  txqueuelen 1000  (Ethernet)
        RX packets 25949  bytes 32082286 (32.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8864  bytes 821106 (821.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
           

到這就完成啦

下面是配置多ip,首先打開ip的配置檔案

[email protected]:~# vim /etc/netplan/00-installer-config.yaml

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      dhcp4: no
      addresses: [192.168.206.100/24]  #以此類推配置多個
      addresses: [192.168.206.101/24]
      addresses: [192.168.206.102/24]
      gateway4: 192.168.206.1
      nameservers:
       addresses: [ 8.8.8.8 ]
  version: 2
           

改完配置檔案,重新開機生效驗證

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      dhcp4: no
      addresses: [192.168.206.100/24]
      addresses: [192.168.206.101/24]
      addresses: [192.168.206.102/24]
      gateway4: 192.168.206.1
      nameservers:
       addresses: [ 8.8.8.8 ]
  version: 2
           

完成

繼續閱讀