- 论坛徽章:
- 0
|
经常有一些朋友问如何在Solaris 10配置双网,并设置两个网关出口,下面我就把Solaris 10 双网卡双网关的配置帖出来给大家参考一下。
一、环境描述
+-----------+ +-------------+
| | | Rourer1 |
| | CE0:172.16.0.8→ | 172.16.0.1 | ------>172.16.0.0/16
IXDBA.NET社区论坛
| | +-------------+
| Solsris |
| | +-------------+
| | CE1:192.168.0.8→| Rourer1 |
| | | 192.168.0.1 |------->互联网(0)
+-----+-----+ +-------------+
如上图所示,Solaris 10机器有CE0和CE1两张网卡,分配给CE0的IP地址为172.16.0.8/24 网关172.16.0.1访问172.16.0.0 255.255.0.0的网段;分配给CE1的ip地址为192.168.0.8/24 网关为192.168.0.1 访问互联网的资源。
二、Solaris 10 双网卡配置
2.1双网卡的IP地址配置
############修改/etc/hosts文件#####################
# Internet host table
#
127.0.0.1 localhost
172.16.0.8 intranet intranet.net loghost
192.168.0.8 internet internet.net loghost
# intranet计算机名对应IP为172.16.0.8
# internet计算机名对应IP为192.168.0.8
#/etc/hosts和/etc/inet/ipnodes文件相同
##################################################
##############修改/etc/inet/ipnodes文件##################
# Internet host table
#
127.0.0.1 localhost
172.16.0.8 intranet intranet.net loghost
192.168.0.8 internet internet.net loghost
# intranet计算机名对应IP为172.16.0.8
# internet计算机名对应IP为192.168.0.8
#/etc/hosts和/etc/inet/ipnodes文件相同
##################################################
###########修改/etc/hostname.ce0文件###################
intranet
#在/etc/hostname.ce0填入计算机名:intranet,标识ce0网卡配置172.16.0.8的IP地址
##################################################
#############修改/etc/hostname.ce1文件####################
internet
#在/etc/hostname.ce1填入计算机名internet标识ce1网卡配置192.168.0.8的IP地址
##################################################
#########/etc/netmasks################################
#
# The netmasks file associates Internet Protocol (IP) address
# masks with IP network numbers.
#
# network-number netmask
#
# The term network-number refers to a number obtained from the Internet Network
# Information Center.
#
# Both the network-number and the netmasks are specified in
# "decimal dot" notation, e.g:
#
# 128.32.0.0 255.255.255.0
#
172.16.0.0 255.255.255.0
192.168.0.0 255.255.255.0
#配置IP地址的掩码
##################################################
2.2双网卡出口路由配置
A、默认路由配置
#######/etc/defaultrouter##############################
192.168.0.8
#配置默认路由为192.168.0.8
##################################################
由于solaris只能配置一个默认路由,因此必须按照如下方法设置静态路由。
B、配置静态路由
route add net 172.16.0.0 -netmask 255.255.0.0 172.16.0.8
想要让静态路由命令重新启动后有效,有多种方法,我这边介绍两种方法
方法一:可以把这条命令加到系统环境设置文件如/profile(如果打过补丁/profile-EIS)
方法二:做一个自动启动脚本:
########/etc/init.d/routeadd##############################
#!/bin/sh
route add net 172.16.0.0 -netmask 255.255.0.0 172.16.0.8
##################################################
在/etc/rc2.d创建一个连接
ln -s /etc/init.d/routeadd /etc/rc2.d/S99routeadd
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/60332/showart_2037708.html |
|