Cisco RIP v2 IP Routing

RIPv2-2


RouterA(config)#router rip
RouterA(config-router)#version 2
RouterA(config-router)#network 192.168.10.0
RouterA(config-router)#network 195.14.25.0
RouterA(config-router)#network 195.14.125.0
RouterA(config-router)#no auto-summary

RouterB(config)#router rip
RouterB(config-router)#version 2
RouterB(config-router)#network 192.168.20.0
RouterB(config-router)#network 195.14.25.0
RouterB(config-router)#network 195.14.125.0
RouterA(config-router)#no auto-summary

RouterC(config)#router rip
RouterC(config-router)#version 2
RouterC(config-router)#network 192.168.30.0
RouterC(config-router)#network 195.14.25.0
RouterC(config-router)#no auto-summary

References :

http://blog.pluralsight.com/cisco-how-to-configure-rip-2

Cisco RIP v1 IP Routing

RIPv1-1


RouterA(config)#router rip
RouterA(config-router)#network 192.168.10.0
RouterA(config-router)#network 195.14.25.0
RouterA(config-router)#network 195.14.125.0

RouterB(config)#router rip
RouterB(config-router)#network 192.168.20.0
RouterB(config-router)#network 195.14.25.0
RouterB(config-router)#network 195.14.125.0

RouterC(config)#router rip
RouterC(config-router)#network 192.168.30.0
RouterC(config-router)#network 195.14.25.0

References :

http://blog.pluralsight.com/cisco-how-to-configure-rip-1

Calculate IP


Address: 192.168.0.1 11000000.10101000.00000000 .00000001
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111 .00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000 .11111111
=>
Network: 192.168.0.0/24 11000000.10101000.00000000 .00000000 (Class C)
Broadcast: 192.168.0.255 11000000.10101000.00000000 .11111111
HostMin: 192.168.0.1 11000000.10101000.00000000 .00000001
HostMax: 192.168.0.254 11000000.10101000.00000000 .11111110
Hosts/Net: 254 (Private Internet)

References :

http://jodies.de/ipcalc

Cisco Router IP Traffic Export


R1>enable
R1#configure terminal
R1(config)# ip traffic-export profile MyProfile
R1(conf-rite)# interface f0/0
R1(conf-rite)# mac-address 0001.0203.0405
R1(conf-rite)# bidirectional
R1(conf-rite)# exit

R1(config)# interface s0/0
R1(config-if)# ip traffic-export apply MyProfile 

R1# show ip traffic-export

References :

http://www.cisco.com/c/en/us/td/docs/ios/12_4t/12_4t11/ht_rawip.html http://packetlife.net/blog/2009/oct/26/capturing-serial-traffic-ethernet-rite/
http://keepingitclassless.net/2010/10/raw-ip-traffic-export-rite-on-cisco-ios/

Join bytes in Python

def run_server():
    HOST = ''
    PORT = 11000
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind((HOST, PORT))
    s.listen(10)

    while True:
        conn, addr = s.accept()
        print("{0} - ".format(get_counter()) + 'Connection from : {0}'.format(addr))

        data_recv=conn.recv(1024)
        data=bytearray()

        conn.settimeout(1)

        while len(data_recv)>0:
            data.extend(data_recv)
            try:
                data_recv=conn.recv(1024)
            except socket.timeout:
                break

        data=str(data)
        if data=="1":
            message=get_message1()
            conn.sendall(message)
        conn.close()

References :

http://stackoverflow.com/questions/9099145/where-are-python-bytearrays-used

Bytes stream in Python

    @staticmethod
    def from_bin(dataB):
        reader=io.BytesIO(dataB)
        length1= reader.read(4)
        length2=reader.read(4)
        length3=reader.read(4)
        macs=reader.read(length1)
        uid=reader.read(length2)
        signature=reader.read(length3)
        reader.close()

        message=Message(macs,uid,signature)
        return message

References :
https://docs.python.org/3/library/io.html#io.BytesIO http://chimera.labs.oreilly.com/books/1230000000393/ch05.html#_solution_78
https://docs.python.org/2/library/io.html