因为ubuntu和centos的网卡名称不一样,所以,首先查询到ubuntu网卡的名称:
在终端输入:ls /proc/sys/net/ipv4/conf 查看网卡名称
sudo vim /etc/network/interfaces
编辑网卡信息如下:
auto eno1 iface eno1 inet static address 192.168.1.101 netmask 255.255.0 gateway 192.168.1.1
保存,重启网卡:
/etc/init.d/networking restart
配置SSH server
apt-get install -y openssh-server
允许root登录
vim /etc/ssh/sshd_config
将里面的PermitRootLogin后门的参数改成yes保存
重启ssh service ssh restart即可。
【绑定多IP到网卡】:
auto eth0 iface eth0 inet static address 192.168.1.10 netmask255.255.255.0 gateway 192.168.1.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 8.8.8.8 8.8.4.4 dns-search 7322.libawangluo.com auto eth0:0 iface eth0:0 inet static address 192.168.1.11 netmask 255.255.255.0
重启除lo网卡的所有网卡
ifdown --exclude=lo -a && ifup --exclude=lo -a