docker_practice/advanced_network/bridge.md

46 lines
1.3 KiB
Go
Raw Normal View History

##
2017-11-29 10:23:42 +08:00
`docker0`
2014-09-18 17:38:20 +08:00
Docker 使 `-b BRIDGE``--bridge=BRIDGE` 使
2014-09-18 17:38:20 +08:00
2017-11-13 18:54:38 +08:00
```bash
$ sudo systemctl stop docker
2014-09-05 15:50:54 +08:00
$ sudo ip link set dev docker0 down
$ sudo brctl delbr docker0
```
2017-11-29 10:23:42 +08:00
`bridge0`
2017-11-29 10:23:42 +08:00
2017-11-13 18:54:38 +08:00
```bash
2014-09-05 15:50:54 +08:00
$ sudo brctl addbr bridge0
$ sudo ip addr add 192.168.5.1/24 dev bridge0
$ sudo ip link set dev bridge0 up
```
2017-11-29 10:23:42 +08:00
2014-09-18 17:38:20 +08:00
2017-11-29 10:23:42 +08:00
2017-11-13 18:54:38 +08:00
```bash
2014-09-05 15:50:54 +08:00
$ ip addr show bridge0
4: bridge0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state UP group default
link/ether 66:38:d0:0d:76:18 brd ff:ff:ff:ff:ff:ff
inet 192.168.5.1/24 scope global bridge0
valid_lft forever preferred_lft forever
```
2017-11-29 10:23:42 +08:00
Docker `/etc/docker/daemon.json` Docker
```json
{
"bridge": "bridge0",
}
2014-09-05 15:50:54 +08:00
```
2017-11-29 10:23:42 +08:00
Docker
2017-11-29 10:23:42 +08:00
`bridge0`
2014-09-18 17:38:20 +08:00
`brctl show` 使 `ip addr` `ip route` IP