When using docker to build an intermediate gateway (like raspberry pi), we may expect a following workflow:
Set DHCP server's published default gateway to be intermediate gateway's LAN IP;
Set intermediate gateway (the docker container)'s default gateway to be router's LAN IP.
However, currently docker-net-dhcp will always use DHCP published gateway when creating the container, and when that published IP is the same as container's lease IP, an error Destination unreachable will raise, preventing us to modify the gateway later after the container created.
Thus, this PR add a new option gateway when creating the docker network, to forcibly uses a user-provided gateway instead of one provided by DHCP when creating the container.
When using docker to build an intermediate gateway (like raspberry pi), we may expect a following workflow:
However, currently
docker-net-dhcp
will always use DHCP published gateway when creating the container, and when that published IP is the same as container's lease IP, an errorDestination unreachable
will raise, preventing us to modify the gateway later after the container created.Thus, this PR add a new option
gateway
when creating the docker network, to forcibly uses a user-provided gateway instead of one provided by DHCP when creating the container.Usage example:
docker create .... -o bridge=br-eth -o gateway=192.168.0.2