免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1519 | 回复: 0
打印 上一主题 下一主题

solaris10中添加网卡以及绑定多IP [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-01 13:45 |只看该作者 |倒序浏览
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.15  webserver1
192.168.1.65  webserver2
# 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.15  netmask 255.255.255.0 up
# ifconfig pcn0:2 inet 192.168.1.65  netmask 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
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP