PG1X WIKI

My Knowledge Base

User Tools

Site Tools


tech:network:cisco:multicast:introduction-lab:introduction-lab

WIP: Multicast Introduction Lab

Lab 1: 96ed25d3-a288-42bd-963d-6f85474fbbd2

configure terminal
!
ip multicast-routing
!
end
96ed25d3-a288-42bd-963d-6f85474fbbd2
network-infrastructure.multicast.introduction.96ed25d3

network-infrastructure.multicast.introduction.96ed25d3.yaml · master · CCIE Enterprise Infrastructure v1.0 / labs · GitLab

  • R1
configure terminal
!
interface GigabitEthernet0/0
 ip address 172.16.0.1 255.255.255.0
 no shutdown
!
end
  • R2
configure terminal
!
interface GigabitEthernet0/0
 ip address 172.16.0.2 255.255.255.0
 no shutdown
!
end
  • SW1
configure terminal
!
ip default-gateway 172.16.0.1
!
interface Vlan1
 ip address 172.16.0.101 255.255.255.0
 no shutdown
!
end
  • ubuntu-0
#cloud-config
password: cisco
chpasswd: { expire: False }
hostname: ubuntu-0
ssh_pwauth: True
ssh_authorized_keys:
   - ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBIbn2VyO9Mby6BwkijQmGfH8O2+Uqewn0/oIOXOxMNgCZiztR3v2o5n1l9ET1GuN7iVMe9whoUiNuZMUVEv0INb+A6Yd0M/37tlWlC+qbIjjqL6UzJAqRISdGP1oVmnV2g== wnoguchi@lasthope.pg1x.net
packages:
   - curl
   - ftp
   - iperf
   - iperf3
   - netcat-openbsd
   - bind9-utils
   - fping
write_files:
- path: /etc/netplan/51-cloud-init_static.yaml
  permissions: '0644'
  content: |
     network:
        version: 2
        ethernets:
           ens2:
              match:
                 name: ens2
              addresses:
                 - 172.16.0.200/24
              gateway4: 172.16.0.1
              #nameservers:
              #   addresses:
              #      - 8.8.8.8
              #      - 8.8.4.4
              #      - 1.1.1.1
runcmd:
   - [ sudo, netplan, generate ]
   - [ sudo, netplan, apply ]
ubuntu@ubuntu-0:~$ ip a s ens2
2: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:15:50:0a brd ff:ff:ff:ff:ff:ff
    inet 172.16.0.200/24 brd 172.16.0.255 scope global ens2
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe15:500a/64 scope link 
       valid_lft forever preferred_lft forever
sudo ip route add 224.0.0.0/4 dev ens2
mcast.py
import socket
import struct
 
MCAST_GRP = '239.0.1.1'
MCAST_PORT = 8080
LOCAL_IP = '17.16.0.200'
 
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.setsockopt(socket.SOL_SOCKET, 25, 'ens2')
sock.bind((MCAST_GRP, MCAST_PORT))
 
 
sock.setsockopt(socket.IPPROTO_IP,
                socket.IP_ADD_MEMBERSHIP,
                socket.inet_aton(MCAST_GRP) + socket.inet_aton(LOCAL_IP))
 
while True:
  # For Python 3, change next line to "print(sock.recv(10240))"
  #Python3
  print(sock.recv(10240))
ubuntu@ubuntu-0:~$ sudo python3 mcast.py 
Traceback (most recent call last):
  File "mcast.py", line 10, in <module>
    sock.setsockopt(socket.SOL_SOCKET, 25, 'ens2')
TypeError: a bytes-like object is required, not 'str'
ubuntu@ubuntu-0:~$ sudo python3 mcast.py 
Traceback (most recent call last):
  File "mcast.py", line 14, in <module>
    sock.setsockopt(socket.IPPROTO_IP,
OSError: [Errno 19] No such device
show ip mroute
show ip igmp groups
tech/network/cisco/multicast/introduction-lab/introduction-lab.txt · Last modified: 2021/05/05 11:28 by wnoguchi