[docker]使用quaaga实现(rip ospf)实现主机间容器互通
2023-09-27 14:21:16 时间
使用quaaga实现(rip ospf)实现主机间容器互通
- n1设置
brctl addbr br0
ip a a 10.1.1.1/24 br0
ip a a 10.1.1.1/24 dev br0
ip l s dev br0 up
systemctl stop docker
dockerd -b=br0
docker run -itd --name=router --privileged --net=host georce/router
- n2设置
brctl addbr br0
ip a a 20.1.1.1/24 br0
ip a a 20.1.1.1/24 dev br0
ip l s dev br0 up
systemctl stop docker
dockerd -b=br0
docker run -itd --name=router --privileged --net=host georce/router
georce/router的dockerfile
https://hub.docker.com/r/georce/router/~/dockerfile/
FROM debian:jessie
MAINTAINER 谁改谁去死!
RUN apt-get update
RUN apt-get install -y quagga
COPY daemons /etc/quagga/daemons
COPY ospfd.conf /etc/quagga/ospfd.conf
COPY ripd.conf /etc/quagga/ripd.conf
COPY run.sh /opt/run.sh
RUN chmod 755 /opt/run.sh
RUN chown quagga:quagga /etc/quagga/*.conf
CMD ["/opt/run.sh"]
quagga提供了startup-configure
这个镜像同时跑了rip和ospf
root@n2:/# cat /etc/quagga/ripd.conf
!
! Zebra configuration saved from vty
! 2015/05/16 14:07:09
!
hostname ripd
password zebra
log stdout
!
router rip
version 2
network 0.0.0.0/0
!
line vty
!
root@n2:/# cat /etc/quagga/ospfd.conf
!
! Zebra configuration saved from vty
! 2015/05/16 14:03:27
!
hostname ospfd
password zebra
log stdout
!
!
!
interface docker0
!
interface eth0
!
interface lo
!
router ospf
network 0.0.0.0/0 area 0.0.0.0
!
line vty
!
命令基本和思科的差不多
root@n2:/# vtysh
n2.ma.com# show ip route rip
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, A - Babel,
> - selected route, * - FIB route
R 10.1.1.0/24 [120/2] via 192.168.1.11, eth0, 00:07:00
n2.ma.com# show ip route os
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, A - Babel,
> - selected route, * - FIB route
O>* 10.1.1.0/24 [110/20] via 192.168.1.11, eth0, 00:07:12
O 20.1.1.0/24 [110/10] is directly connected, br0, 00:07:26
O>* 127.0.0.1/32 [110/10] is directly connected, lo, 00:07:26
O 172.17.0.0/16 [110/10] is directly connected, docker0, 00:07:26
O 192.168.1.0/24 [110/10] is directly connected, eth0, 00:07:26
测试docker连通性
docker run -it --rm busybox
/ # ping 10.1.1.1
PING 10.1.1.1 (10.1.1.1): 56 data bytes
64 bytes from 10.1.1.1: seq=387 ttl=63 time=0.568 ms
64 bytes from 10.1.1.1: seq=388 ttl=63 time=0.992 ms
64 bytes from 10.1.1.1: seq=389 ttl=63 time=0.955 ms
支持的路由协议
root@n2:/# vtysh
n2.ma.com# conf t
n2.ma.com(config)# router
babel Babel
bgp BGP information
isis ISO IS-IS
ospf Start OSPF configuration
ospf6 Open Shortest Path First (OSPF) for IPv6
rip RIP
ripng RIPng
相关文章
- Docker-Compose 入门到精通 (图解+秒懂+史上最全)
- docker logs命令查看容器日志的时候,如何将标准输出和错误输出进行区分查看?
- docker容器内安装yum,vim等应用
- 【Docker】保存镜像、 容器到本地, 从本地加载镜像、 容器
- 基于Docker开发的PaaS平台 DINP
- 如何在Docker容器中运行GUI程序
- docker部署项目注意事项记录
- Docker Map Host /etc/host to Container
- Docker笔记-attach进入容器,退出后容器停止运行
- Docker容器下安装Kong网关
- [转]20个令人惊叹的桌面Docker容器
- Docker容器------安装+镜像加速
- 《Docker容器:利用Kubernetes、Flannel、Cockpit和Atomic构建和部署》——第1章 使用Docker对应用进行容器化 1.1了解容器化应用的优缺点
- 《Docker容器:利用Kubernetes、Flannel、Cockpit和Atomic构建和部署》——1.3 探究容器
- docker安装centos后没有ifconfig命令解决办法
- Docker环境搭建与使用:docker容器的基本使用方法
- Docker修改容器内部文件的方法
- Docker 部署 Prometheus
- Docker使用exec进入正在运行中的容器
- 使用nodejs构建Docker image最佳实践
- docker基础之docker-compose多容器启动(十)
- docker gitlab-ce 容器root密码重置小记
- 思科扩展Docker合作 开发容器网络软件
- 我们该期待怎样的Docker使用体验,是容器还是集装箱?
- php5使用docker工具安装mcrypt
- docker容器必须要有前台进程
- Windows 上安装docker
- 如何在Fedora 22上面配置Apache的Docker容器
- Docker收购Unikernel Systems,继续打造容器生态体系
- docker容器和宿主机的主机名映射失败