Solaris 指定通讯接口方法----分享
时间:2010-06-25
来源:互联网
一、环境
- root@e5kd6 # more /etc/defaultrouter
- 192.168.0.129
-
- root@e5kd6 # more /etc/netmasks
- 192.168.0.0 255.255.255.0
-
- root@e5kd6 # netstat -rn
-
- Routing Table: IPv4
- Destination Gateway Flags Ref Use Interface
- -------------------- -------------------- ----- ----- ------ ---------
- 192.168.0.0 192.168.0.59 U 1 0 ge0
- default 192.168.0.129 UG 1 194
- 127.0.0.1 127.0.0.1 UH 101964416 lo0
-
- root@e5kd6 # ifconfig -a
-
- ge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
- inet 192.168.0.59 netmask ffffff00 broadcast 192.168.0.255
- ether 8:0:20:ff:1b:5c
作者: rusty_rui 发布时间: 2010-06-25
- root@e5kd6 # ifconfig ge0 addif 192.168.0.57 netmask + broadcast + up
- Created new logical interface ge0:1
- Setting netmask of ge0:1 to 255.255.255.0
-
- root@e5kd6 # ifconfig -a
- lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
- inet 127.0.0.1 netmask ff000000
- ge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
- inet 192.168.0.59 netmask ffffff00 broadcast 192.168.0.255
- ether 8:0:20:ff:1b:5c
- ge0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
- inet 192.168.0.57 netmask ffffff00 broadcast 192.168.0.255
-
- root@e5kd6 # netstat -rn
-
- Routing Table: IPv4
- Destination Gateway Flags Ref Use Interface
- -------------------- -------------------- ----- ----- ------ ---------
- 192.168.0.0 192.168.0.59 U 1 0 ge0
- 192.168.0.0 192.168.0.57 U 1 0 ge0:1
- default 192.168.0.129 UG 1 196
- 127.0.0.1 127.0.0.1 UH 101964707 lo0
-
- root@e5kd6 # traceroute 10.109.109.33
- traceroute: Warning: Multiple interfaces found; using 192.168.0.59 @ ge0
- traceroute to 10.109.109.33 (10.109.109.33), 30 hops max, 40 byte packets
- 1 192.168.0.2 (192.168.0.2) 1.321 ms 0.397 ms 0.365 ms
- 2 10.109.109.33 (10.109.109.33) 0.358 ms 0.333 ms 0.315 ms
作者: zhmzhouming: 发布时间: 2010-06-25
配置1、期望使用192.168.0.57用于服务器间通信,配置过Sun Cluster的同仁对此应该不陌生。那就是使用deprecated参数:
Marks the address as a deprecated address. Addresses
marked as deprecated will not be used as source
address for outbound packets unless either there are
no other addresses available on this interface or the
application has bound to this address explicitly. The
status display shows DEPRECATED as part of flags. See
INTERFACE FLAGS for information on the flags supported
by ifconfig.
对需要进行限制通信的接口使用此参数,使用此参数的接口地址原则上不参与主动通信,仅当没有其他可用的接口地址用于通信时才承担主动通信任务。可以使用 "-deprecated"参数取消此限制。注:使用deprecated参数的地址,被动访问还是要提供服务的。
此测试中计划使用192.168.0.57作为业务地址,那么我们需要限制ge0端口地址192.168.0.59:
- root@e5kd6 # ifconfig ge0 deprecated
- [b]root@e5kd6 # ifconfig -a[/b]
- lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
- inet 127.0.0.1 netmask ff000000
- ge0: flags=1040843<UP,BROADCAST,RUNNING,MULTICAST,[b]DEPRECATED[/b],IPv4> mtu 1500 index 6
- inet 192.168.0.59 netmask ffffff00 broadcast 192.168.0.255
- ether 8:0:20:ff:1b:5c
- ge0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
- inet 192.168.0.57 netmask ffffff00 broadcast 192.168.0.255
-
- root@e5kd6 # traceroute 10.109.109.33
- traceroute: Warning: Multiple interfaces found; [b]using 192.168.0.57 @ ge0:1[/b]
- traceroute to 10.109.109.33 (10.109.109.33), 30 hops max, 40 byte packets
- 1 192.168.0.3 (192.168.0.3) 1.780 ms 0.385 ms 0.344 ms
- 2 10.109.109.33 (10.109.109.33) 0.398 ms 0.310 ms 0.308 ms
-
- 已经按照预定端口ge0:1进行通讯
-
- root@e5kd6 # netstat -rn
-
- Routing Table: IPv4
- Destination Gateway Flags Ref Use Interface
- -------------------- -------------------- ----- ----- ------ ---------
- 192.168.0.0 192.168.0.57 U 1 1 ge0:1
- 192.168.0.0 192.168.0.57 U 1 0 ge0
- default 192.168.0.129 UG 1 201
- 127.0.0.1 127.0.0.1 UH 101967996 lo0
作者: rusty_rui 发布时间: 2010-06-25
此测试计划在ge0:1接口专项用于通讯至10.109.109.33地址:
环境:
- root@e5kd6 # ifconfig -a
- lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
- inet 127.0.0.1 netmask ff000000
- ge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
- inet 192.168.0.59 netmask ffffff00 broadcast 192.168.0.255
- ether 8:0:20:ff:1b:5c
- ge0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
- inet 192.168.0.57 netmask ffffff00 broadcast 192.168.0.255
-
- root@e5kd6 # netstat -rn
-
- Routing Table: IPv4
- Destination Gateway Flags Ref Use Interface
- -------------------- -------------------- ----- ----- ------ ---------
- 192.168.0.0 192.168.0.59 U 1 0 ge0
- 192.168.0.0 192.168.0.57 U 1 0 ge0:1
- default 192.168.0.129 UG 1 196
- 127.0.0.1 127.0.0.1 UH 101964707 lo0
-
- root@e5kd6 # traceroute 10.109.109.33
- traceroute: Warning: Multiple interfaces found; using 192.168.0.59 @ ge0
- traceroute to 10.109.109.33 (10.109.109.33), 30 hops max, 40 byte packets
- 1 192.168.0.2 (192.168.0.2) 1.321 ms 0.397 ms 0.365 ms
- 2 10.109.109.33 (10.109.109.33) 0.358 ms 0.333 ms 0.315 ms
作者: rusty_rui 发布时间: 2010-06-25
在此测试中需要用到destination 参数。
修改配置:
- root@e5kd6 # ifconfig ge0:1 destination 10.109.109.33
- root@e5kd6 # ifconfig -a
- lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
- inet 127.0.0.1 netmask ff000000
- ge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
- inet 192.168.0.59 netmask ffffff00 broadcast 192.168.0.255
- ether 8:0:20:ff:1b:5c
- ge0:1: flags=1000851<UP,POINTOPOINT,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
- inet 192.168.0.57 --> 10.109.109.33 netmask ffffff00
-
- root@e5kd6 # traceroute 10.109.109.33
- traceroute: Warning: Multiple interfaces found; using 192.168.0.57 @ ge0:1
- traceroute to 10.109.109.33 (10.109.109.33), 30 hops max, 40 byte packets
- 1 192.168.0.2 (192.168.0.2) 1.855 ms 0.413 ms 0.359 ms
- 2 10.109.109.33 (10.109.109.33) 0.352 ms 0.521 ms 0.327 ms
-
- 已经按照既定端口ge0:1 通信
- root@e5kd6 # netstat -rn
-
- Routing Table: IPv4
- Destination Gateway Flags Ref Use Interface
- -------------------- -------------------- ----- ----- ------ ---------
- 10.109.109.33 192.168.0.57 UH 1 1 ge0:1
- 192.168.00 192.168.0.57 U 1 0 ge0
- default 192.168.0.129 UG 1 194
- 127.0.0.1 127.0.0.1 UH 101964070 lo0
作者: rusty_rui 发布时间: 2010-06-25


作者: rusty_rui 发布时间: 2010-06-25
作者: rusty_rui 发布时间: 2010-06-25
作者: liuxitao0728 发布时间: 2010-06-25
谢谢分享。非常不错。
作者: yoyosys 发布时间: 2010-06-25
作者: cwnlinux 发布时间: 2010-06-25

作者: cwnlinux 发布时间: 2010-06-25
作者: zhmzhouming 发布时间: 2010-06-25
。
作者: shuiyueya 发布时间: 2010-06-25
受教了,谢谢。
作者: alex_xie 发布时间: 2010-06-25
作者: nimysun 发布时间: 2010-06-25
作者: westlife521 发布时间: 2010-06-25
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28