ubuntu18.04 use ifconfig command, only lo, there is no solution ens33

solution:

1. Input: lspci or lspci -v or  lspci-vv, first determine the NIC (driver) is present but not enabled.

2. Enter ifconfig -a command to display eth0 and lo.

3. Enter ifconfig ens33 up, enabled NIC. This time with ifconfig, only to see inet6 (ipv6?) Address, no address inet (ie ip Xshell connected to the input).

4.Ubuntu 18.04 netplan use to configure the network, its configuration file is yaml format. After installing Ubuntu 18.04, the default in etc / netplan / the / directory configuration file name is 50-cloud-init.yaml, we modify it by VIM:

sudo vim /etc/netplan/50-cloud-init.yaml 

Profiles amended as follows:

network:
    ethernets:
        ens160:
            addresses: [192.168.144.129/24] # IP及掩码
            gateway4: 192.168.144.1 # 网关
            nameservers:
                addresses: [8.8.8.8] # DNS
    version: 2


Whether or ifupdown netplan, the idea of ​​the configuration are the same, fill in the IP, mask, gateway, DNS and other information in accordance with the rules in the configuration file inside. Note yaml is a hierarchy, indent, colon (:) in the dictionary, a hyphen (-) indicates the list.

Restart the network service configuration to take effect:

sudo netplan apply 

 

Published 23 original articles · won praise 2 · views 10000 +

Guess you like

Origin blog.csdn.net/wenson0705/article/details/104899759