Thursday, June 26, 2014

GNS3 Again

  • tap interfaces
  • bridge interfaces
  • virtualbox setup
  • IOS images
  • ASA images
  • Juniper images
  • VirtualBox guest

1. Install software

apt-get install gns3 dynamips uml-utilities bridge-utils

2. Apply dynamips permissions so that dynamips does not have to run with root privileges, and avoid this kind of issues.

sudo setcap cap_dac_override,cap_net_admin,cap_net_raw+eip /usr/bin/dynamips

check with sudo getcap /usr/bin/dynamips

3.  Set folder structure.

/home/user/GNS3/
├── Images
│   ├── ASA
│   ├── IOS
│   ├── Juniper
│   ├── Qemu guest
│   └── VB Guest
├── IOU
├── projects
│   ├── ccna_3_final
│   ├── OSPF AREAS
│   ├── OSPF AREAS - Initial Topology
│   ├── test1
│   ├── test2
│   ├── test3
│   └── test-Run
├── Qemu
├── TMP
└── WD

4. Set your terminal in GNS3 > Edit >Preferences > General > Terminal Settings (optional)

5. The settings for dynamips should be similar with yours.

6. Add IOS images.

I use 124-25,c or d for all the routers, except the 7200.

7. Optional - ASA  Image, Juniper, VirtualBox guest.

qemu options are optional: -smp4 may not be needed but vga and vnc none are so that you will not be shown qemu's window

qemu options: -vnc none -vga none -m 1024 -icount auto -hdachs 980,16,32

kernel cmd line:ide_generic.probe_mask=0x01 ide_core.chs=0.0:980,16,32 auto nousb console=ttyS0,9600 bigphysarea=65536

8. Creating tap interfaces.

Dynamips auto-creates the tap interfaces. In case you need them at startup or want to make them in the command line you can do the following:

tunctl             This will create loopback interface tap0
ifconfig tap0 10.100.100.100 netmask 255.255.255.0 upIf you want to add one more loopback interface
root@ admin-desktop:~#tunctl             This will create loopback interface tap1
root@ admin-desktop:~#ifconfig tap1 10.100.101.100 netmask 255.255.255.0 up

or

/etc/network/interfaces.d/tapX.cfg

auto tap0
    iface tap0 inet static
    address 10.1.0.1
    netmask 255.255.255.0
    hwaddress ether 00:00:00:00:00:0a
    tunctl_user uml-net

the tap interfaces created by dynamips are without IP addresses. This ok because all the tap interfaces are connected to a bridge

For this topology:

R3: f0/0 10.20.30.50/24

R4: f/0/ 10.20.30.51/24

VM: 10.20.30.40/24

br0: 10.20.30.100/24

tun1,2,3 - no ip address.

Things needed:

- ip forwarding

- firewall rule for ithe FORWARD chain iptables -A FORWARD -m physdev --physdev-is-bridged -j ACCEPT

 

root ~ # brctl showmacs brid0
port no mac addr                is local?       ageing timer
  1     00:00:00:00:00:a0       yes                0.00
  2     00:00:00:00:00:a1       yes                0.00
  3     00:00:00:00:00:a2       yes                0.00
  1     08:00:27:f3:ad:ae       no                 0.41--> VM
  2     c4:03:64:7d:00:00       no                 6.74--> cisco
  3     c4:04:64:7d:00:00       no                 9.84--> cisco


root ~ # brctl show brid0
bridge name     bridge id               STP enabled     interfaces
brid0           8000.0000000000a0       no              tap0
                                                        tap1
                                                        tap2
root ~ # ifconfig
brid0     Link encap:Ethernet  HWaddr 00:00:00:00:00:a0 
          inet addr:10.20.30.100  Bcast:10.20.30.255  Mask:255.255.255.0
          inet6 addr: fe80::200:ff:fe00:a0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1745 errors:0 dropped:66 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:376183 (367.3 KiB)  TX bytes:17381 (16.9 KiB)

eth0      Link encap:Ethernet  HWaddr 00:22:15:63:bb:d7 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1493644 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1320133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1753593912 (1.6 GiB)  TX bytes:898228269 (856.6 MiB)
          Interrupt:17

eth1      Link encap:Ethernet  HWaddr 00:22:15:63:cf:0d 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:18

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:153196 errors:0 dropped:0 overruns:0 frame:0
          TX packets:153196 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:13227655 (12.6 MiB)  TX bytes:13227655 (12.6 MiB)

tap0      Link encap:Ethernet  HWaddr 00:00:00:00:00:a0 
          inet6 addr: fe80::200:ff:fe00:a0/64 Scope:Link
          UP BROADCAST PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:7000 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

tap1      Link encap:Ethernet  HWaddr 00:00:00:00:00:a1 
          inet6 addr: fe80::200:ff:fe00:a1/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:5431 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4676 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:1404689 (1.3 MiB)  TX bytes:606508 (592.2 KiB)

tap2      Link encap:Ethernet  HWaddr 00:00:00:00:00:a2 
          inet6 addr: fe80::200:ff:fe00:a2/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:4194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2960 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:843494 (823.7 KiB)  TX bytes:418781 (408.9 KiB)

No comments:

Post a Comment