I'm using OpenWrt on the GNS3 Network Simulator docker container support. The container is based on "openwrtorg/rootfs". What version is based on this? I find version "OpenWrt SNAPSHOT, r17444-1c8214d6f2".
GNS3 Note:
It is difficult to add interfaces to container within docker command. GNS3 container easy to add interfaces just type number. I'm using Dockerfile as follow.
FROM openwrtorg/rootfs:x86-64
USER root
RUN mkdir -p /var/lock && mkdir -p /var/run && opkg update && \
opkg install uhttpd luci-base luci-mod-admin-full luci-theme-bootstrap luci-app-firewall && \
rm /var/opkg-lists/* && \
uci set luci.ccache.enable=0 && \
uci commit luci && \
uci set network.lan=interface && \
uci set network.lan.ifname='eth1' && \
uci set network.lan.proto='static' && \
uci set network.lan.ipaddr='192.168.1.1' && \
uci set network.lan.netmask='255.255.255.0' && \
uci commit network && \
(echo '#!/bin/ash'; \
echo 'if [ -d "/gns3volumes" ]; then'; \
echo ' if [ ! -f "/gns3volumes/etc/network/config/.gns3" ]; then'; \
echo ' cp -a /etc/config /gns3volumes/etc/network/'; \
echo ' touch /gns3volumes/etc/network/config/.gns3'; \
echo ' fi'; \
echo ' if [ -f "/gns3volumes/etc/network/config/.gns3" ]; then'; \
echo ' mount --bind /gns3volumes/etc/network/config /etc/config'; \
echo ' fi'; \
echo 'fi'; \
echo '# Init iptables for firewall start.'; \
echo 'mkdir -p /tmp/run'; \
echo '/usr/sbin/iptables -L >/dev/null'; \
echo '/usr/sbin/iptables -t nat -L >/dev/null'; \
echo 'exec "$@"') >/config-run.sh && \
chmod a+x /config-run.sh
EXPOSE 80
CMD ["/config-run.sh","/sbin/init"]
OpenWrt snapshot, so not a specific release. the "1c8214d6f2" is a commit ID, you can search in the OpenWrt Github repo to see what is the last commit included in the container build
In this specific case, it's a commit from 6 days ago, https://github.com/openwrt/openwrt/search?q=1c8214d6f2&type=commits
so that container was built with the OpenWrt development source code, taken 6 days ago.
OpenWrt should automatically use first eth interface as LAN and second interface as WAN, also default IP is already 192.168.1.1 so as long as you create your container with two interfaces you should get them already OK
Dear bobafetthotmail. Many thanks for your information.
The version is latest snapshot. I hope for an official release that supports docker container.
192.168.1.1 doesn't seem to be used in docker image
$ docker run --rm -it --privileged openwrtorg/rootfs:x86-64
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
Please press Enter to activate this console.
BusyBox v1.33.1 (2021-08-28 11:24:23 UTC) built-in shell (ash)
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt SNAPSHOT, r17444-1c8214d6f2
-----------------------------------------------------
root@OpenWrt:/# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
312: eth0@if313: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
inet6 fe80::42:acff:fe11:2/64 scope link
valid_lft forever preferred_lft forever
root@OpenWrt:/# cat /etc/config/network
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
config interface 'wan6'
option ifname 'eth0'
option proto 'dhcp6'