Auxiliary Tools :: Network Simulation Using VirtualBox and Quagga (Fedora 25 / Centos 7)

 

Based on http://www.brianlinkletter.com/how-to-use-virtualbox-to-emulate-a-network/

Network topology

Virtual Machines (Centos 7 / Fedora 25)

I use VirtualBox v. 5.1.20 on Windows 10.
To login into VMs I use root.
I installed Fedora 25 (router-1, router-2, router-3, pc-1, pc-2, pc-3).

==========================================================
====================== CONNECTIONS ======================
==========================================================

——- pc-1

VirtualBox:
1. Hostname: pc-1
2. Storage: Fedora-MATE_Compiz-Live-x86_64-25-1.3.iso
3. Network > Adapter 2 > Enable Network Adapter / Internal Network / Name = intnet-1

Install VM:
4. Install to Hard Drive
5. host name: pc-1
6. user: zibi/***

7. dnf update

OpenSSH (to use ssh from host computer – after port forwarding):
8. systemctl enable sshd.service
9. systemctl start sshd.service
10. netstat -ant | grep 22

Network Connections (Fedora GUI: System > Preferences > Internet and Network > Network Connection > enp0s8 > Edit):
11. 192.168.1.1/24
12. Routes: 192.168.0.0/16 gateway 192.168.1.254

Disable firewalld and prevent it from starting at boot:
13. systemctl disable firewalld
14. systemctl stop firewalld

reboot

——– pc-2

VirtualBox:
1. Hostname: pc-2
2. Storage: Fedora-MATE_Compiz-Live-x86_64-25-1.3.iso
3. Network > Adapter 2 > Enable Network Adapter / Internal Network / Name = intnet-2

Install VM:
4. Install to Hard Drive
5. host name: pc-2
6. user: zibi/***

7. dnf update

OpenSSH (to use ssh from host computer – after port forwarding):
8. systemctl enable sshd.service
9. systemctl start sshd.service
10. netstat -ant | grep 22

Network Connections (Fedora GUI: System > Preferences > Internet and Network > Network Connection > enp0s8 > Edit):
11. 192.168.2.1/24
12. Routes: 192.168.0.0/16 gateway 192.168.2.254

Disable firewalld and prevent it from starting at boot:
13. systemctl disable firewalld
14. systemctl stop firewalld

reboot

——– pc-3

VirtualBox:
1. Hostname: pc-3
2. Storage: Fedora-MATE_Compiz-Live-x86_64-25-1.3.iso
3. Network > Adapter 2 > Enable Network Adapter / Internal Network / Name = intnet-3

Install VM:
4. Install to Hard Drive
5. host name: pc-3
6. user: zibi/***

7. dnf update

OpenSSH (to use ssh from host computer – after port forwarding):
8. systemctl enable sshd.service
9. systemctl start sshd.service
10. netstat -ant | grep 22

Network Connections (Fedora GUI: System > Preferences > Internet and Network > Network Connection > enp0s8 > Edit):
11. 192.168.3.1/24
12. Routes: 192.168.0.0/16 gateway 192.168.3.254

Disable firewalld and prevent it from starting at boot:
13. systemctl disable firewalld
14. systemctl stop firewalld

reboot

======================= routers =======================

———– router-1

VirtualBox:
1. Hostname: router-1
2. Storage: Fedora-MATE_Compiz-Live-x86_64-25-1.3.iso
3. Network > Adapter 2 > Enable Network Adapter / Internal Network / Name = intnet-1
4. Network > Adapter 3 > Enable Network Adapter / Internal Network / Name = intnet-100
5. Network > Adapter 4 > Enable Network Adapter / Internal Network / Name = intnet-101

Install VM:
6. Install to Hard Drive
7. host name: router-1
8. user: zibi/***

Start VM
9. dnf update
10. dnf install quagga
11. dnf install traceroute

OpenSSH (to use ssh from host computer – after port forwarding):
12. systemctl enable sshd.service
13. systemctl start sshd.service
14. netstat -ant | grep 22

Connections (Fedora GUI: System > Preferences > Internet and Network > Network Connection > {enp0s8, enp0s9, enp0s10} > Edit):
15. enp0s8: 192.168.1.254/24
16. enp0s9: 192.168.100.1/24
17. enp0s10: 192.168.101.2/24

Disable firewalld and prevent it from starting at boot:
18. systemctl disable firewalld
19. systemctl stop firewalld

reboot

———– router-2

VirtualBox:
1. Hostname: router-2
2. Storage: Fedora-MATE_Compiz-Live-x86_64-25-1.3.iso
3. Network > Adapter 2 > Enable Network Adapter / Internal Network / Name = intnet-2
4. Network > Adapter 3 > Enable Network Adapter / Internal Network / Name = intnet-100
5. Network > Adapter 4 > Enable Network Adapter / Internal Network / Name = intnet-102

Install VM:
6. Install to Hard Drive
7. host name: router-2
8. user: zibi/***

Start VM
9. dnf update
10. dnf install quagga
11. dnf install traceroute

OpenSSH (to use ssh from host computer – after port forwarding):
12. systemctl enable sshd.service
13. systemctl start sshd.service
14. netstat -ant | grep 22

Connections (Fedora GUI: System > Preferences > Internet and Network > Network Connection > {enp0s8, enp0s9, enp0s10} > Edit):
15. enp0s8: 192.168.2.254/24
16. enp0s9: 192.168.100.2/24
17. enp0s10: 192.168.102.2/24

Disable firewalld and prevent it from starting at boot:
18. systemctl disable firewalld
19. systemctl stop firewalld

reboot

———– router-3

VirtualBox:
1. Hostname: router-3
2. Storage: Fedora-MATE_Compiz-Live-x86_64-25-1.3.iso
3. Network > Adapter 2 > Enable Network Adapter / Internal Network / Name = intnet-3
4. Network > Adapter 3 > Enable Network Adapter / Internal Network / Name = intnet-101
5. Network > Adapter 4 > Enable Network Adapter / Internal Network / Name = intnet-102

Install VM:
6. Install to Hard Drive
7. host name: router-3
8. user: zibi/***

Start VM
9. dnf update
10. dnf install quagga
11. dnf install traceroute

OpenSSH (to use ssh from host computer – after port forwarding):
12. systemctl enable sshd.service
13. systemctl start sshd.service
14. netstat -ant | grep 22

Connections (Fedora GUI: System > Preferences > Internet and Network > Network Connection > {enp0s8, enp0s9, enp0s10} > Edit):
15. enp0s8: 192.168.3.254/24
16. enp0s9: 192.168.101.1/24
17. enp0s10: 192.168.102.1/24

Disable firewalld and prevent it from starting at boot:
18. systemctl disable firewalld
19. systemctl stop firewalld

reboot

============================================================
==================== PORT FORWARDING ======================
============================================================

VirtualBox (Network > Adapter 1 > Advanced > Port Forwarding):

1. pc-1: Name: SSH Protocol: TCP Host Port: 14501 Guest Port: 22
2. pc-2: Name: SSH Protocol: TCP Host Port: 14502 Guest Port: 22
3. pc-3: Name: SSH Protocol: TCP Host Port: 14503 Guest Port: 22
4. router-1: Name: SSH Protocol: TCP Host Port: 14601 Guest Port: 22
5. router-2: Name: SSH Protocol: TCP Host Port: 14602 Guest Port: 22
6. router-3: Name: SSH Protocol: TCP Host Port: 14603 Guest Port: 22

Test SSH Windows -> VM

===========================================================
================== QUAGGA CONFIGURATION =================
===========================================================

———– router-1

1. Crate file: /etc/quagga/ospfd.conf
2. chmod 777 /etc/quagga/*.conf
3. systemctl enable zebra.service
4. systemctl enable ospfd.service
5. /etc/sysconfig/quagga uncomment WATCH_DAEMONS=”zebra bgpd ospfd ospf6d ripd ripngd”
6. setsebool -P zebra_write_config 1
7. enable ip_forward:

echo “net.ipv4.ip_forward = 1” >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

8. File “/etc/quagga/zebra.conf”:

hostname router-1
password zebra
enable password zebra
interface enp0s3
no link-detect
ipv6 nd suppress-ra
interface enp0s8
no link-detect
ip address 192.168.1.254/24
ipv6 nd suppress-ra
interface enp0s9
no link-detect
ip address 192.168.100.1/24
ipv6 nd suppress-ra
interface enp0s10
no link-detect
ip address 192.168.101.2/24
ipv6 nd suppress-ra
interface lo
no link-detect
ip forwarding
line vty

9. systemctl start zebra.service (systemctl status zebra.service)

10. File “/etc/quagga/ospfd.conf”:

password zebra
enable password zebra
interface enp0s8
interface enp0s9
interface enp0s10
interface lo
router ospf
passive-interface enp0s8
network 192.168.1.0/24 area 0.0.0.0
network 192.168.100.0/24 area 0.0.0.0
network 192.168.101.0/24 area 0.0.0.0
line vty

11. systemctl start ospfd.service (systemctl status ospfd.service)

———– router-2

1. Crate file: /etc/quagga/ospfd.conf
2. chmod 777 /etc/quagga/*.conf
3. systemctl enable zebra.service
4. systemctl enable ospfd.service
5. “/etc/sysconfig/quagga” uncomment WATCH_DAEMONS=”zebra bgpd ospfd ospf6d ripd ripngd”
6. setsebool -P zebra_write_config 1
7. enable ip_forward:

echo “net.ipv4.ip_forward = 1” >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

8. File “/etc/quagga/zebra.conf”:

hostname router-2
password zebra
enable password zebra
interface enp0s8
ip address 192.168.2.254/24
ipv6 nd suppress-ra
interface enp0s9
ip address 192.168.100.2/24
ipv6 nd suppress-ra
interface enp0s10
ip address 192.168.102.2/24
ipv6 nd suppress-ra
interface lo
ip forwarding
line vty

9. systemctl start zebra.service (systemctl status zebra.service)

10. File “/etc/quagga/ospfd.conf”:

password zebra
enable password zebra
interface enp0s8
interface enp0s9
interface enp0s10
router ospf
passive-interface enp0s8
network 192.168.2.0/24 area 0.0.0.0
network 192.168.100.0/24 area 0.0.0.0
network 192.168.102.0/24 area 0.0.0.0
line vty

11. systemctl start ospfd.service (systemctl status ospfd.service)

———– router-3

1. Crate file: /etc/quagga/ospfd.conf
2. chmod 777 /etc/quagga/*.conf
3. systemctl enable zebra.service
4. systemctl enable ospfd.service
5. /etc/sysconfig/quagga uncomment WATCH_DAEMONS=”zebra bgpd ospfd ospf6d ripd ripngd”
6. setsebool -P zebra_write_config 1
7. enable ip_forward:

echo “net.ipv4.ip_forward = 1” >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

8. File “/etc/quagga/zebra.conf”:

hostname router-3
password zebra
enable password zebra
interface enp0s3
no link-detect
ipv6 nd suppress-ra
interface enp0s8
no link-detect
ip address 192.168.3.254/24
ipv6 nd suppress-ra
interface enp0s9
no link-detect
ip address 192.168.101.1/24
ipv6 nd suppress-ra
interface enp0s10
no link-detect
ip address 192.168.102.1/24
ipv6 nd suppress-ra
interface lo
no link-detect
ip forwarding
line vty

9. systemctl start zebra.service (systemctl status zebra.service)

10. File “/etc/quagga/ospfd.conf”:

password zebra
enable password zebra
interface enp0s3
interface enp0s8
interface enp0s9
interface enp0s10
interface lo
router ospf
passive-interface enp0s8
network 192.168.3.0/24 area 0.0.0.0
network 192.168.101.0/24 area 0.0.0.0
network 192.168.102.0/24 area 0.0.0.0
line vty

11. systemctl start ospfd.service (systemctl status ospfd.service)

==========================================================
======================= SIMPLE TEST =======================
==========================================================

 

Leave a Reply