linux 下网络配置

ubuntu 18

重起

/etc/init.d/networking restart

配置ip

cat /etc/network/interfaces


# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto enp2s0f1
iface enp2s0f1 inet static
address 1.1.1.3
netmask 255.255.255.240
gateway 1.1.1.1
onboot yes

ubuntu 16

配置ip

/sbin/ifconfig eno1:1 1.1.1.2 netmask 255.255.255.240 up

添加路由
/sbin/route add -net 1.1.0.0 netmask 255.255.0.0 gw 1.1.1.1

freeBSD 

重起

/etc/netstart restart

猜你喜欢

转载自www.cnblogs.com/zhangyy3/p/11926542.html