本篇教程基于恩山论坛:https://www.right.com.cn/forum/thread-365151-1-1.html 创作
依赖的软件包:
- pppoeconf
- isc-dhcp-server
你需要先安装这些软件,以便进行拨号、DHCP分发。
apt install pppoeconf isc-dhcp-server -y
修改位于 /etc/default/isc-dhcp-server 的配置文件:
# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="br0"
#INTERFACESv6=""
Code language: PHP (php)
编辑位于 /etc/dhcp/dhcpd.conf 的配置文件:
option domain-name "phicomm-n1";
subnet 192.168.21.0 netmask 255.255.255.0 {
range 192.168.21.2 192.168.21.254;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.21.255;
option routers 192.168.21.1;
option domain-name-servers 192.168.21.1,119.29.29.29;
}
default-lease-time 600;
max-lease-time 7200;
authoritative;
Code language: JavaScript (javascript)
编辑位于 /etc/network/interfaces 的配置文件:
source /etc/network/interfaces.d/*
# Wired adapter #1
allow-hotplug eth0
no-auto-down eth0
iface eth0 inet manual
#address 192.168.0.100
#netmask 255.255.255.0
#gateway 192.168.0.1
#dns-nameservers 8.8.8.8 8.8.4.4
# hwaddress ether # if you want to set MAC manually
# pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838
# Wireless adapter #1
# Armbian ships with network-manager installed by default. To save you time
# and hassles consider using 'sudo nmtui' instead of configuring Wi-Fi settings
# manually. The below lines are only meant as an example how configuration could
# be done in an anachronistic way:
#
#allow-hotplug wlan0
#iface wlan0 inet dhcp
#address 192.168.0.100
#netmask 255.255.255.0
#gateway 192.168.0.1
#dns-nameservers 8.8.8.8 8.8.4.4
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# Disable power saving on compatible chipsets (prevents SSH/connection dropouts over WiFi)
#wireless-mode Managed
#wireless-power off
auto br0
iface br0 inet static
bridge_ports eth0:0
address 192.168.21.1
broadcast 192.168.21.255
network 192.168.21.0
netmask 255.255.255.0
gateway 192.168.21.1
bridge_stp off
bridge_waitport 0
bridge_fd 0
# Local loopback
auto lo
iface lo inet loopback
auto dsl-provider
iface dsl-provider inet ppp
pre-up /bin/ip link set br0 up # line maintained by pppoeconf
provider dsl-provider
Code language: PHP (php)
编辑位于 /etc/rc.local 的配置文件:
ifconfig eth0:0 192.168.21.1 up
iptables -t nat -A POSTROUTING -j MASQUERADE
pon dsl-provider
exit 0
Code language: CSS (css)
配置PPPOE的账号:
pppoeconf
重启测试:
reboot
关于软路由其他的进阶教程,请在本博客内查找。
了解 Starx's Home 的更多信息
Subscribe to get the latest posts sent to your email.
0 条评论