-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter_c.dockerfile
70 lines (58 loc) · 1.56 KB
/
router_c.dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
FROM alpine:latest
RUN apk add --no-cache openssh quagga iputils
# CONFIGURE OPENSSH
RUN echo -e "Port 22\n\
AddressFamily any\n\
ListenAddress 0.0.0.0\n\
PermitRootLogin yes\n\
PasswordAuthentication yes" >> /etc/ssh/sshd_config
RUN echo root:root123 | chpasswd
RUN /usr/bin/ssh-keygen -A
RUN ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_key
# CONFIGURE QUAGGA
RUN adduser zebra -G quagga -s /usr/bin/vtysh -D
RUN echo zebra:zebra | chpasswd
RUN mkdir /var/log/quagga/
RUN chown quagga:quagga /var/log/quagga/
# CONFIGURE ZEBRA
RUN echo -e "!\n\
password zebra\n\
enable password zebra\n\
log file /var/log/quagga/zebra.log\n\
!\n\
interface lo\n\
ip address 192.168.99.3/32\n\
!" > /etc/quagga/zebra.conf
RUN chown quagga:quagga /etc/quagga/zebra.conf
RUN chmod 640 /etc/quagga/zebra.conf
# CONFIGURE OSPFD
RUN echo -e "!\n\
router ospf\n\
network 172.20.0.0/24 area 0.0.0.1\n\
network 192.168.99.3/32 area 0.0.0.1\n\
!"> /etc/quagga/ospfd.conf
RUN chown quagga:quagga /etc/quagga/ospfd.conf
RUN chmod 640 /etc/quagga/ospfd.conf
# CONFIGURE BGPD
RUN echo -e "!\n\
router bgp 64512\n\
bgp router-id 192.168.99.3\n\
network 192.168.99.3/32\n\
neighbor 172.20.0.131 remote-as 64512\n\
neighbor 172.20.0.132 remote-as 64512\n\
!\n\
address-family ipv6\n\
exit-address-family\n\
exit\n\
!" > /etc/quagga/bgpd.conf
RUN chown quagga:quagga /etc/quagga/bgpd.conf
RUN chmod 640 /etc/quagga/bgpd.conf
# START SCRIPT
RUN echo -e "#!bin/sh\n\
\n\
zebra -d -f /etc/quagga/zebra.conf\n\
ospfd -d\n\
bgpd -d\n\
/usr/sbin/sshd -D" >> /start.sh
RUN chmod +x /start.sh
CMD ["/start.sh"]