# 复制一份网卡配置文件cp-a/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-eth0:1#编辑刚复制的配置文件:vi/etc/sysconfig/network-scripts/ifcfg-eth0:1#修改DEVICE名称为文件名DEVICE=eth0:1#然后将ip部分填写成新的ip地址IPADDR=xxx.xxx.xxx.xxx#退出并保存:wq
然后重复以上步骤,依次创建
ifcfg-eth0:2,ifcfg-eth0:3,ifcfg-eth0:4,这样分配的5个IP就都可以用上了#最后重启网卡/etc/init.d/network restart检查配置是否生效
ifconfig
看看有没有新添加的IP信息,或者Ping一下新IP
可能遇到的问题:
Determining if ip address …. is already in use for device eth0..
可以在配置文件后面加入ARPCHECK=noecho'ARPCHECK=no'>>/etc/sysconfig/network-scripts/ifcfg-eth0
修改虚拟主机配置
usr/local/nginx/conf/vhost/XXXX.com.conflisten 80
改为
listen xx.xx.xx.xx:80;
server_name xxx.com;
if ($host ~* “\d+\.\d+\.\d+\.\d+”){
return 400;
}
这样可以禁止IP访问.只可以使用域名访问。包括你绑定到的IP,这样更利于SEO,亦可以防止IP被发现后,导致IP被直接攻击。
重启查看效果
/usr/local/nginx/sbin/nginx -s reload
debian:
编辑/etc/network/interfaces 文件在最后添加附加进来的IP
auto eth0:0
iface eth0:0 inet static
address 194.xx.xx.xx
netmask 255.255.255.0
iface eth0:0 inet static
address 194.xx.xx.xx
netmask 255.255.255.0
auto eth0:1
iface eth0:1 inet static
address 194.xx.xx.xx
netmask 255.255.255.0
/etc/init.d/networking restart
