Debian双网卡环境和静态路由

5,988次阅读
一条评论

共计 1008 个字符,预计需要花费 3 分钟才能阅读完成。

 

最近测试垃圾邮件网关 Scrollout F1, 这个系统需要运行在 debian 7 上面,以前一直玩 RH 系的,对 debian 系统还有些陌生。

debian7 下载了一个 netinstall 的 ISO,按提示安装完成后配置网络,在安装过程中需要联网,已经配置好了 eth1, 我们做为邮件网关需要双网卡工作,所以还需要来配置 eth0 接入内网。

debian 配置网卡和 RH 不同的是所有网卡都在同一个配置文件中,编辑 /etc/network/interfaces 文件即可

以下为配置文件

 

# The primary network interface
auto eth0                                                         #网卡开机启动
iface eth0 inet static                                      #定义为静态 IP
        mtu 1492                                                  #定义 MTU
        address 192.168.100.113                      #定义 IP 地址
        netmask 255.255.255.0                          #定义子网掩码
        dns-nameservers 192.168.100.253      #定义 DNS
        up route add -net 192.168.0.0/16 gateway 192.168.100.1 dev eth0                       #eth0 连接增加静态路由
        down route del -net 192.168.0.0/16 gateway 192.168.100.1 dev eth0                   #eth0 断开删除指定路由

# The second network interface
auto eth1
iface eth1 inet static
        mtu 1492
        address x.x.x.x
        netmask y.y.y.y
        gateway z.z.z.z
        dns-nameservers 223.6.6.6

当然,将静态路由写入 /etc/rc.local 也是可行的。

正文完
 
Winter
版权声明:本站原创文章,由 Winter 2017-06-28发表,共计1008字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(一条评论)
验证码