一.启动网卡
ubuntu server 安装后,ifconfig 发现只有一个lo 和一个p1p1 网卡,
先查看服务器网卡:ifconfig -a ,发现有lo ,p1p1,p2p1,p3p1,p4p1
要启动其他网卡,可以通过
ifconfig p2p1 up #启动p2p1网卡
二.配置网卡
如果需要把网卡配置为指定ip的,
首先
vi /etc/network/interfaces
添加网卡p2p1,p3p1,p4p1
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto p1p1
iface p1p1 inet dhcp
iface p2p1 inet dhcp
iface p3p1 inet dhcp
iface p4p1 inet dhcp
示例:
address 127.127.127.127
netmask 255.255.255.0
gateway 127.127.127.254
配置:
ifconfig em1 127.127.127.127 netmask 255.255.255.0
route add default gw 127.127.127.254 #添加网关
#重启网卡
/etc/init.d/networking restart
ifconfig em1 down
ifconfig em1 up
ifconfig #查看
service networking restart #不用sudo
参考:https://blog.csdn.net/lingbofeiyun/article/details/51566799