(1) Ubuntu 系列(18及以上)
关防火墙
sudo ufw disable
sudo ufw status
开防火墙
sudo ufw enable
修改配置文件:/etc/netplan/00-installer-config.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2

renderer: NetworkManager

ethernets:
ens33:
addresses: [10.15.5.202/24]
gateway4: 10.15.5.1
nameservers:
addresses: [114.114.114.114]
:wq(保存退出)
netplan apply #使配置生效
各系统配置网络

(2) Ubuntu系列(16及以下)
修改配置文件:vi /etc/network/interfaces
auto eth0(自己的网卡名)
iface eth0 inet static
address 10.15.5.209
netmask 255.255.255.0
gateway 10.15.5.1
dns-nameserver 114.114.114.114
:wq (保存退出)
重启网络:systemctl restart networking
或者:/etc/init.d/networking restart
(3)Suse 配置网络
vi /etc/sysconfig/network/config将
#NETCONFIG_DNS_POLICY="auto"将这行注释
vi /etc/resolv.conf 配DNS
nameserver 8.8.8.8
nameserver 8.8.4.4
cd /etc/sysconfig/network
BOOTPROTO=‘static’
IPADDR=‘10.15.12.21’
NETMASK=‘255.255.255.0’
GATEWAY=‘10.15.12.1’
NETWORK=‘10.15.12.0’
STARTMODE=‘auto’
ONBOOT=yes
DEVICE=eth15
vi ifroute-eth15 配置网关
default 10.15.12.1

up网络ifconfig ethx up
ip link set ethx up
ifup ethx

~

相关文章: