1、网关主机设置
服务器上有两块网卡,eth0使用*.*.*.*IP地址连接Internet,eth1连接LAN,则其/etc/network/interfaces的设置如下:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address *.*.*.*
netmask 255.255.255.0
gateway *.*.*.254
auto eth1
iface eth1 inet static
address 192.168.0.1
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
当然也可以使用ifconfig进行配置:
$ ifconfig eth0 *.*.*.* netmask 255.255.255.0
$ route add default gw *.*.*.254
$ ifconfig eth1 192.168.0.1 netmask 255.255.255.0
dns在/etc/resolv.conf中设置,修改或添加nameserver字段:
nameserver 202.120.2.101
如果ip地址是与mac绑定的,还要修改mac地址:
$ ifconfig eth0 down
$ ifconfig eth0 hw ether *:*:*:*:*:*
$ ifconfig eth0 up <
使用Debian Linux操作系统架设网关
最新推荐文章于 2024-04-08 11:15:20 发布
这篇博客介绍了如何使用Debian Linux操作系统设置网关,包括网关主机的网络配置、IP伪装(ipmasq)的安装和端口映射(iptables)的使用。通过这些步骤,可以实现LAN内的机器通过共享IP地址访问Internet,并进行特定端口的服务对外映射。
摘要由CSDN通过智能技术生成