[已解决][问题]ubuntu 单网卡双IP组建局域网
发表于 : 2008-05-12 17:42
ubuntu7.04 组建实验室局域网
由于实验室条件有限,于是使用单网卡双IP组建局域网
在/etc/network/interfaces
auto lo eth0
iface lo inet loopback
#auto eth0
iface eth0 inet static
address 202.114.2.237
netmask 255.255.255.0
gateway 202.114.2.254
#auto eth0:1
iface eth0:1 inet static
address 192.168.20.2
netmask 255.255.255.0
auto eth1
iface eth1 inet dhcp
auto eth2
iface eth2 inet dhcp
auto ath0
iface ath0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
在终端ping 192.168.20.2 正常,局域网内任一PC ping 192.168.20.2 或202.114.2.237正常
ifconfig -a 也能正常看到eth0:1的相关信息
sysctl.conf文件
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
net/ipv4/icmp_echo_ignore_broadcasts=1
# the following stops low-level messages on console
kernel.printk = 4 4 1 7
##############################################################3
# Functions previously found in netbase
#
# Uncomment the next line to enable Spoof protection (reverse-path filter)
net.ipv4.conf.default.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.conf.default.forwarding=1
# Uncomment the next line to enable packet forwarding for IPv6
#net.ipv6.conf.default.forwarding=1
且使用sysctl -p激活设备
问题为:服务器(Ubuntu)可以正常上网,但局域网内的PC不能正常上网,请各位帮忙,小弟先谢过了!
由于实验室条件有限,于是使用单网卡双IP组建局域网
在/etc/network/interfaces
auto lo eth0
iface lo inet loopback
#auto eth0
iface eth0 inet static
address 202.114.2.237
netmask 255.255.255.0
gateway 202.114.2.254
#auto eth0:1
iface eth0:1 inet static
address 192.168.20.2
netmask 255.255.255.0
auto eth1
iface eth1 inet dhcp
auto eth2
iface eth2 inet dhcp
auto ath0
iface ath0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
在终端ping 192.168.20.2 正常,局域网内任一PC ping 192.168.20.2 或202.114.2.237正常
ifconfig -a 也能正常看到eth0:1的相关信息
sysctl.conf文件
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
net/ipv4/icmp_echo_ignore_broadcasts=1
# the following stops low-level messages on console
kernel.printk = 4 4 1 7
##############################################################3
# Functions previously found in netbase
#
# Uncomment the next line to enable Spoof protection (reverse-path filter)
net.ipv4.conf.default.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.conf.default.forwarding=1
# Uncomment the next line to enable packet forwarding for IPv6
#net.ipv6.conf.default.forwarding=1
且使用sysctl -p激活设备
问题为:服务器(Ubuntu)可以正常上网,但局域网内的PC不能正常上网,请各位帮忙,小弟先谢过了!