solaris10中添加网卡以及绑定多IP
solaris10中添加网卡以及绑定多IP一、添加网卡:
首先关闭电源插入新网卡,然后使用ifconfig interface_name plumb激活网卡,然后向其添加IP地址,示例如下:
# ifconfig pcn1 plumb
# ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
pcn0: flags=1000843 mtu 1500 index 2 inet 192.168.1.129 netmask ffffff00
broadcast 192.168.1.255 ether 0:c:29:d4:89:f
pcn1: flags=1000842 mtu 1500 index 4 inet 0.0.0.0 netmask 0 ether 0:c:29:d4:89:19
这时候还没有配置IP,所以如上所示,接着配置IP地址:
#ifconfig pcn1 192.168.1.131 netmask 255.255.255.0 up
#ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000
pcn0: flags=1000843 mtu 1500 index 2 inet 192.168.1.129 netmask ffffff00
broadcast 192.168.1.255 ether 0:c:29:d4:89:f
pcn1: flags=1000843 mtu 1500 index 4 inet 192.168.1.131 netmask ffffff00
broadcast 192.168.1.255 ether 0:c:29:d4:89:19
# ping 192.168.1.131
192.168.1.131 is alive
这样的配置在系统重新启动后会自动消失的,为了不让它消失,须作如下处理:
# vi /etc/hosts
# Internet host table
#
::1 localhost
127.0.0.1 localhost
192.168.1.129 sol10 sol10
192.168.1.124 solaris10
solaris10 192.168.1.112 xzxj xzxj
192.168.1.131 zfs-zones zfs-zones
加入"192.168.1.131 zfs-zones zfs-zones" 这条记录后保存退出。如果你的第二块网卡和第一块网卡不在同一网段的话 ,你还要修改/etc/netmasks文件,加入对应网段的子网掩码。接着创建/etc/hostname.pcn1文件,加入这个网卡所对应的主机名。重启后查看。
# reboot/shutdown -y -i6 -g0/init 6
# ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000
pcn0: flags=1000843 mtu 1500 index 2 inet 192.168.1.129 netmask ffffff00
broadcast 192.168.1.255 ether 0:c:29:d4:89:f
pcn1: flags=1000843 mtu 1500 index 3 inet 192.168.1.131 netmask ffffff00
broadcast 192.168.1.255 ether 0:c:29:d4:89:19
二、绑定多个IP:
举例说明,网卡名pcn0:
# vi /etc/hosts
127.0.0.1 localhost
192.168.1.123 sol10 sol10
192.168.1.15webserver1
192.168.1.65webserver2
# vi /etc/netmasks
192.168.1.0 255.255.255.0
#vi /etc/hostname.pcn0
sol10
创建以下两个文件/etc/hostname.pcn0:1和/etc/hostname.pcn0:2,内容如下:
#vi /etc/hostname.pcn0:1
webserver1
#vi /etc/hostname.pcn0:2
Webserver2 设置生效
#ifconfig pcn0:1 plumb
#ifconfig pcn0:2 plumb
# ifconfig pcn0 inet 192.168.1.123 netmask 255.255.255.0 up
# ifconfig pcn0:1 inet 192.168.1.15netmask 255.255.255.0 up
# ifconfig pcn0:2 inet 192.168.1.65netmask 255.255.255.0 up
重启系统,查看
# init 6 或者reboot
#ifconfig -a
三、Solaris下修改mac地址
用ifconfig 命令即可修改mac地址,假设接口名为nge0,要将mac地址修改为aa:bb:cc:
dd
:ee:ff,可以运行如下命令:
# ifconfig nge0 ether aa:bb:cc:dd:ee:ff
要永久生效,在/etc/hostname.nge0添一行
ether aa:bb:cc:dd:ee:ff
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/36549/showart_513683.html
页:
[1]