基于L大10.24更新的R9 10.24版
ip link set ens33 promisc on
ip link set ens34 promisc on
modprobe pppoe
docker network create -d macvlan \
--subnet=172.16.60.0/24 --gateway=172.16.60.254 \
--ipv6 --subnet=fe80::/16 --gateway=fe80::1 \
-o parent=ens33 \
-o macvlan_mode=bridge \
openwrt-LAN
docker network create -d macvlan \
--subnet=192.168.0.0/24 --gateway=192.168.0.254 \
--ipv6 --subnet=fe82::/16 --gateway=fe82::1 \
-o parent=ens34 \
-o macvlan_mode=bridge \
openwrt-WAN
docker run -it -d \
--restart=always \
--network=openwrt-LAN \
--privileged \
--name=openwrt \
--cap-add=NET_ADMIN \
raiuka/openwrt_on_docker \
docker network connect openwrt-WAN openwrt
ip link add link ens33 vLAN type macvlan mode bridge
ip addr add 172.16.60.253/24 brd + dev vLAN
ip link set vLAN up
ip route del default
ip route add default via 172.16.60.1 dev vLAN
# 设置静态 dns 服务器(IP地址自行修改)
echo "nameserver 172.16.60.1" > /etc/resolv.conf
# 进入容器
docker exec -it openwrt /bin/sh
# 编辑 /etc/config/network
config interface 'lan'
option type 'bridge'
option ifname 'eth0'
option proto 'static'
option ipaddr '172.16.60.1' #LAN口IP地址自行修改
option netmask '255.255.255.0'
option ip6assign '64'
config interface 'wan'
option proto 'pppoe'
option ifname 'eth1' # 假定ens34接口为WAN口,OpenWRT的eth1接口桥接在ens34接口上
option username 'PPPOE用户名'
option password 'PPPOE密码'
option keepalive '0'
option ipv6 'auto'
# 重启 openwrt 网络
/etc/init.d/network restart
剩下的事情就是你自己怎么玩OpenWRT了。 Enjoy~
Content type
Image
Digest
Size
124.5 MB
Last updated
almost 7 years ago
docker pull raiuka/openwrt_on_docker:11.08