=========================================
PPPoE Server 配置
=======================================
环境搭建:
eth2
设为WAN侧网卡,自动获取,如:IP:4.4.4.10/MASK:255.255.255.0/GW:4.4.4.1/DNS:202.96.209.5,210.22.70.3
eth3
设为LAN侧网卡,手动配置为: IP:11:11:11:1/MASK:255.255.255.0/GW:4.4.4.1/DNS:202.96.209.5,210.22.70.3
开始配置:
sudo apt-get install vlan
modprobe 8021q
vconfig add eth3 35
vconfig add eth3 42
vconfig add eth3 6
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 6.6.6.0/24 -o eth2 -j SNAT --to 4.4.4.106
iptables -t nat -A POSTROUTING -s 11.11.11.0/24 -o eth2 -j SNAT --to 4.4.4.111
iptables -t nat -A POSTROUTING -s 42.42.42.0/24 -o eth2 -j SNAT --to 4.4.4.142
iptables -t nat -A POSTROUTING -s 35.35.35.0/24 -o eth2 -j SNAT --to 4.4.4.135
killall pppoe-server
pppoe-server -I eth3 -L 11.11.11.1 -R 11.11.11.20 -N 10
ifconfig eth3.6 down
ifconfig eth3.6 6.6.6.1 broadcast 6.6.6.255 netmask 255.255.255.0 up
pppoe-server -I eth3.6 -L 6.6.6.1 -R 6.6.6.2 -N 10
ifconfig eth3.42 down
ifconfig eth3.42 42.42.42.1 broadcast 42.42.42.255 netmask 255.255.255.0 up
pppoe-server -I eth3.42 -L 42.42.42.1 -R 45.42.42.2 -N 10
ifconfig eth3.35 down
ifconfig eth3.35 35.35.35.1 broadcast 35.35.35.255 netmask 255.255.255.0 up
pppoe-server -I eth3.35 -L 35.35.35.1 -R 35.35.35.2 -N 10
=================================================
DHCP Server 配置
================================================
环境搭建:
eth2
设为WAN侧网卡,自动获取,如:IP:4.4.4.10/MASK:255.255.255.0/GW:4.4.4.1/DNS:202.96.209.5,210.22.70.3
eth3
设为LAN侧网卡,手动配置为: IP:11:11:11:1/MASK:255.255.255.0/GW:4.4.4.1/DNS:202.96.209.5,210.22.70.3
ifconfig eth3 down
ifconfig eth3 11.11.11.1 broadcast 11.11.11.255 netmask 255.255.255.0 up
DHCP server安装
1. 安装dhcp3-server
sudo apt-get install dhcp3-server
2. 备份系统原有的配置文件
sudo cp /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf.original
3. 配置config文件,打开/etc/dhcp3/dhcpd.conf,在其中添加或修改以下几句
ddns-update-style none; #定义所支持的DNS动态更新类型(必选)默认为none
default-lease-time 36000; #租约期限,单位为秒
max-lease-time 72000;#最大租约期限
4. 执行DHCP server
/etc/init.d/dhcp3-server restart
#设置IP作用域,格式为subnet 子网ID netmask 子网掩码{}
subnet 11.11.11.0 netmask 255.255.255.0{
range 11.11.11.100 11.11.11.200; #IP地址池
option routers 11.11.11.1; #指定默认网关
option subnet-mask 255.255.255.0; #指定子网掩码
option broadcast-address 11.11.11.255; #指定广播地址
option domain-name-servers 202.96.209.5,210.22.70.3; #指定DNS服务器
default-lease-time 6000;
max-lease-time 72000;
}
subnet 7.7.7.0 netmask 255.255.255.0{
range 7.7.7.100 7.7.7.200; #IP地址池
option routers 7.7.7.1; #指定默认网关
option subnet-mask 255.255.255.0; #指定子网掩码
option broadcast-address 7.7.7.255; #指定广播地址
option domain-name-servers 202.96.209.5,210.22.70.3; #指定DNS服务器
default-lease-time 6000;
max-lease-time 72000;
}
subnet 8.8.8.0 netmask 255.255.255.0{
range 8.8.8.100 8.8.8.200; #IP地址池
option routers 8.8.8.1; #指定默认网关
option subnet-mask 255.255.255.0; #指定子网掩码
option broadcast-address 8.8.8.255; #指定广播地址
option domain-name-servers 202.96.209.5,210.22.70.3; #指定DNS服务器
default-lease-time 6000;
max-lease-time 72000;
}
subnet 10.10.10.0 netmask 255.255.255.0{
range 10.10.10.100 10.10.10.200; #IP地址池
option routers 10.10.10.1; #指定默认网关
option subnet-mask 255.255.255.0; #指定子网掩码
option broadcast-address 10.10.10.255; #指定广播地址
option domain-name-servers 202.96.209.5,210.22.70.3; #指定DNS服务器
default-lease-time 6000;
max-lease-time 72000;
}
开始配置:
sudo apt-get install vlan
modprobe 8021q
vconfig add eth3 7
vconfig add eth3 8
vconfig add eth3 10
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 7.7.7.0/24 -o eth2 -j SNAT --to 4.4.4.107
iptables -t nat -A POSTROUTING -s 8.8.8.0/24 -o eth2 -j SNAT --to 4.4.4.108
iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o eth2 -j SNAT --to 4.4.4.110
ifconfig eth3.7 down
ifconfig eth3.7 7.7.7.1 broadcast 7.7.7.255 netmask 255.255.255.0 up
ifconfig eth3.8 down
ifconfig eth3.8 8.8.8.1 broadcast 8.8.8.255 netmask 255.255.255.0 up
ifconfig eth3.10 down
ifconfig eth3.10 10.10.10.1 broadcast 10.10.10.255 netmask 255.255.255.0 up
/etc/init.d/dhcp3-server restart
阅读(1735) | 评论(0) | 转发(0) |