CentOS下添加IP的方法
一、添加单个IP的方法:
使用cp命令复制一个eth0的文件,新的文件名为eth0:0 ,然后用nano编辑此文件。不习惯用nano的可以用vi等命令。打开文件后编辑:
文件编辑完之后,运行:
用 ifconfig 看新的IP是否已经加上。
二、批量添加IP:
在/etc/sysconfig/network-scripts下创建一个range文件,也可以用vi等编辑
无类域间路由(CIDR)的子网掩码设置参考: http://www.taohost.net/tools/subnet.htm
/29 (5 usable) NETMASK = 255.255.255.248
/28 (13 usable) NETMASK = 255.255.255.240
/27 (29 usable) NETMASK = 255.255.255.224
/26 (61 usable) NETMASK = 255.255.255.192
/25 (125 usable) NETMASK = 255.255.255.128
/24 (253 usable) NETMASK = 255.255.255.0
三、为一块新网卡配置IP地址的方法:
如果是为第二块网卡配IP,在/etc/sysconfig/network-scripts目录下编辑一个ifcfg-eth1的文件:
修改一下IPADDR,NETMASK和GATEWAY的参数。
运行:
/etc/init.d/network reload
一、添加单个IP的方法:
使用cp命令复制一个eth0的文件,新的文件名为eth0:0 ,然后用nano编辑此文件。不习惯用nano的可以用vi等命令。打开文件后编辑:
文件编辑完之后,运行:
用 ifconfig 看新的IP是否已经加上。
二、批量添加IP:
在/etc/sysconfig/network-scripts下创建一个range文件,也可以用vi等编辑
无类域间路由(CIDR)的子网掩码设置参考: http://www.taohost.net/tools/subnet.htm
/29 (5 usable) NETMASK = 255.255.255.248
/28 (13 usable) NETMASK = 255.255.255.240
/27 (29 usable) NETMASK = 255.255.255.224
/26 (61 usable) NETMASK = 255.255.255.192
/25 (125 usable) NETMASK = 255.255.255.128
/24 (253 usable) NETMASK = 255.255.255.0
三、为一块新网卡配置IP地址的方法:
如果是为第二块网卡配IP,在/etc/sysconfig/network-scripts目录下编辑一个ifcfg-eth1的文件:
修改一下IPADDR,NETMASK和GATEWAY的参数。
运行:
/etc/init.d/network reload
用ifconfig看新的IP是否已经加上。
Linux FreeBSD服务器添加IP的方法
往FreeBSD添加IP的方法: vi /etc/rc.conf First line is the main ip address + subnet mask Second line and thereafter use the 'alias' in the config line and netmask of 255.255.255.255 and proper broadcast ip. ALso, may not be fxp0, might be sis0, rltk0, etc.. ifconfig_fxp0="inet 10.10.10.34 netmask 255.255.255.248" ifconfig_fxp0_alias0="inet 10.10.10.35 netmask 255.255.255.255" ifconfig_fxp0_alias1="inet 10.10.10.36 netmask 255.255.255.255" ifconfig_fxp0_alias2="inet 10.10.10.37 netmask 255.255.255.255" etc.. Also you can run /stand/sysconfig Choose Configure, Networking, Interfaces, then nic card ( fxp0, rltk, dlink, rl0, vne, etc...) |
Linux Debian 服务器添加IP的方法!
Debian 服务器添加IP的方法! To add secondary ips in debian do: edit /etc/network/interfaces and add below auto eth0:0 iface eth0:0 inet static address 10.10.10.3 netmask 255.255.255.0 auto eth0:1 iface eth0:1 inet static address 10.10.10.4 netmask 255.255.255.0 修改 Debian Linux server 主IP ---------------------------------------------- vi /etc/hostname vi /etc/hosts vi /etc/network/interfaces and edit the entries below. auto eth0 iface eth0 inet static address 67.159.5.28 netmask 255.255.255.0 network 67.159.5.0 BROADCAST 67.159.5.255 gateway 67.159.5.1 then reboot with 'shutdown -r now' or /etc/init.d/networking restart |