蜗牛大师

吴庆龙的学习笔记

导航

Ubuntu网卡配置

1.查看所有可用网卡

$ ifconfig -a
# -a     display all interfaces which are currently available, even if down

2.编辑配置文件

$ sudo vim /etc/network/interfaces

3.添加可用网卡信息

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp

# Host-Only network interface
auto enp0s8
iface enp0s8 inet static
address 192.168.56.100
netmask 255.255.255.0
gateaway 192.168.56.1

在VBox中安装虚拟机时,网卡enp0s8默认是没有配置的,这里手动配置一下。

4.重启网络服务

$ sudo systemctl restart networking
# 或
$ sudo /etc/init.d/networking restart

5.查看网卡信息

$ ifconfig

posted on 2018-08-08 10:46  蜗牛大师  阅读(433)  评论(0编辑  收藏  举报