Skip to content

Instantly share code, notes, and snippets.

@nickkaranatsios
Last active October 13, 2015 23:38
Show Gist options
  • Save nickkaranatsios/4274159 to your computer and use it in GitHub Desktop.
Save nickkaranatsios/4274159 to your computer and use it in GitHub Desktop.
puppet_chef

lldp packet on my envirnoment at home

To be able to transmit lldp packets using a particular management address you need to specifiy the interface that holds the management ip address.

packets captured using veth0 and management address set 192.168.1.12 which is the veth1 address.

Process started as follows

/usr/sbin/lldpd -I veth0 -m 192.168.1.12

veth1 configuration

ifconfig veth1
veth1     Link encap:Ethernet  HWaddr 1e:5e:f6:16:17:84  
          inet addr:192.168.1.12  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: fe80::1c5e:f6ff:fe16:1784/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:66 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:13258 (13.2 KB)  TX bytes:16293 (16.2 KB)
          

Packet captured from veth0

04:26:11.557033 LLDP, length 198
	Chassis ID TLV (1), length 7
	  Subtype MAC address (4): 36:78:78:9e:74:30 (oui Unknown)
	  0x0000:  0436 7878 9e74 30
	Port ID TLV (2), length 7
	  Subtype MAC address (3): 36:78:78:9e:74:30 (oui Unknown)
	  0x0000:  0336 7878 9e74 30
	Time to Live TLV (3), length 2: TTL 120s
	  0x0000:  0078
	System Name TLV (5), length 20: ubuntu.ubuntu-domain
	  0x0000:  7562 756e 7475 2e75 6275 6e74 752d 646f
	  0x0010:  6d61 696e
	System Description TLV (6), length 93
	  Ubuntu 12.04 LTS\0x0a Linux 3.2.0-38-generic-pae #61-Ubuntu SMP Tue Feb 19 12:39:51 UTC 2013 i686
	  0x0000:  5562 756e 7475 2031 322e 3034 204c 5453
	  0x0010:  0a20 4c69 6e75 7820 332e 322e 302d 3338
	  0x0020:  2d67 656e 6572 6963 2d70 6165 2023 3631
	  0x0030:  2d55 6275 6e74 7520 534d 5020 5475 6520
	  0x0040:  4665 6220 3139 2031 323a 3339 3a35 3120
	  0x0050:  5554 4320 3230 3133 2069 3638 36
	System Capabilities TLV (7), length 4
	  System  Capabilities [Bridge, WLAN AP, Router] (0x001c)
	  Enabled Capabilities [none] (0x0000)
	  0x0000:  001c 0000
	Management Address TLV (8), length 12
	  Management Address length 5, AFI IPv4 (1): ubuntu.local
	  Interface Index Interface Numbering (2): 6
	  0x0000:  0501 c0a8 010c 0200 0000 0600
	Port Description TLV (4), length 5: veth0
	  0x0000:  7665 7468 30
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  Link aggregation Subtype (3)
	    aggregation status [supported], aggregation port ID 0
	  0x0000:  0012 0f03 0100 0000 00
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  MAC/PHY configuration/status Subtype (1)
	    autonegotiation [none] (0x00)
	    PMD autoneg capability [unknown] (0x0000)
	    MAU type 10GBASER (0x0021)
	  0x0000:  0012 0f01 0000 0000 21
	Organization specific TLV (127), length 6: OUI IEEE 802.3 Private (0x00120f)
	  Max frame size Subtype (4)
	    MTU size 0
	  0x0000:  0012 0f04 0000
	End TLV (0), length 0
04:26:41.593186 LLDP, length 198
	Chassis ID TLV (1), length 7
	  Subtype MAC address (4): 36:78:78:9e:74:30 (oui Unknown)
	  0x0000:  0436 7878 9e74 30
	Port ID TLV (2), length 7
	  Subtype MAC address (3): 36:78:78:9e:74:30 (oui Unknown)
	  0x0000:  0336 7878 9e74 30
	Time to Live TLV (3), length 2: TTL 120s
	  0x0000:  0078
	System Name TLV (5), length 20: ubuntu.ubuntu-domain
	  0x0000:  7562 756e 7475 2e75 6275 6e74 752d 646f
	  0x0010:  6d61 696e
	System Description TLV (6), length 93
	  Ubuntu 12.04 LTS\0x0a Linux 3.2.0-38-generic-pae #61-Ubuntu SMP Tue Feb 19 12:39:51 UTC 2013 i686
	  0x0000:  5562 756e 7475 2031 322e 3034 204c 5453
	  0x0010:  0a20 4c69 6e75 7820 332e 322e 302d 3338
	  0x0020:  2d67 656e 6572 6963 2d70 6165 2023 3631
	  0x0030:  2d55 6275 6e74 7520 534d 5020 5475 6520
	  0x0040:  4665 6220 3139 2031 323a 3339 3a35 3120
	  0x0050:  5554 4320 3230 3133 2069 3638 36
	System Capabilities TLV (7), length 4
	  System  Capabilities [Bridge, WLAN AP, Router] (0x001c)
	  Enabled Capabilities [none] (0x0000)
	  0x0000:  001c 0000
	Management Address TLV (8), length 12
	  Management Address length 5, AFI IPv4 (1): ubuntu.local
	  Interface Index Interface Numbering (2): 6
	  0x0000:  0501 c0a8 010c 0200 0000 0600
	Port Description TLV (4), length 5: veth0
	  0x0000:  7665 7468 30
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  Link aggregation Subtype (3)
	    aggregation status [supported], aggregation port ID 0
	  0x0000:  0012 0f03 0100 0000 00
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  MAC/PHY configuration/status Subtype (1)
	    autonegotiation [none] (0x00)
	    PMD autoneg capability [unknown] (0x0000)
	    MAU type 10GBASER (0x0021)
	  0x0000:  0012 0f01 0000 0000 21
	Organization specific TLV (127), length 6: OUI IEEE 802.3 Private (0x00120f)
	  Max frame size Subtype (4)
	    MTU size 0
	  0x0000:  0012 0f04 0000
	End TLV (0), length 0

configuration of my eth0 device

eth0      Link encap:Ethernet  HWaddr 00:22:15:58:80:0d  
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 2408:cb:88c5:0:222:15ff:fe58:800d/64 Scope:Global
          inet6 addr: fe80::222:15ff:fe58:800d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2817 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1864 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:520681 (520.6 KB)  TX bytes:281818 (281.8 KB)
          Interrupt:44 Base address:0x6000 
sudo tcpdump -i eth0 ether proto 0x88cc -vv
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
03:24:24.817452 LLDP, length 197
  Chassis ID TLV (1), length 7
    Subtype MAC address (4): 00:22:15:58:80:0d (oui Unknown)
	  0x0000:  0400 2215 5880 0d
	Port ID TLV (2), length 7
	  Subtype MAC address (3): 00:22:15:58:80:0d (oui Unknown)
	  0x0000:  0300 2215 5880 0d
	Time to Live TLV (3), length 2: TTL 120s
	  0x0000:  0078
	System Name TLV (5), length 20: ubuntu.ubuntu-domain
	  0x0000:  7562 756e 7475 2e75 6275 6e74 752d 646f
	  0x0010:  6d61 696e
	System Description TLV (6), length 93
	  Ubuntu 12.04 LTS\0x0a Linux 3.2.0-38-generic-pae #61-Ubuntu SMP Tue Feb 19 12:39:51 UTC 2013 i686
	  0x0000:  5562 756e 7475 2031 322e 3034 204c 5453
	  0x0010:  0a20 4c69 6e75 7820 332e 322e 302d 3338
	  0x0020:  2d67 656e 6572 6963 2d70 6165 2023 3631
	  0x0030:  2d55 6275 6e74 7520 534d 5020 5475 6520
	  0x0040:  4665 6220 3139 2031 323a 3339 3a35 3120
	  0x0050:  5554 4320 3230 3133 2069 3638 36
	System Capabilities TLV (7), length 4
	  System  Capabilities [Bridge, WLAN AP, Router] (0x001c)
	  Enabled Capabilities [none] (0x0000)
	  0x0000:  001c 0000
	Management Address TLV (8), length 12
	  Management Address length 5, AFI IPv4 (1): ubuntu.local
	  Interface Index Interface Numbering (2): 2
	  0x0000:  0501 c0a8 0103 0200 0000 0200
	Port Description TLV (4), length 4: eth0
	  0x0000:  6574 6830
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
    Link aggregation Subtype (3)
	    aggregation status [supported], aggregation port ID 0
	  0x0000:  0012 0f03 0100 0000 00
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  MAC/PHY configuration/status Subtype (1)
	    autonegotiation [supported, enabled] (0x03)
	    PMD autoneg capability [10BASE-T hdx, 10BASE-T fdx, 100BASE-TX hdx, 100BASE-TX fdx, Pause for fdx links, Asym PAUSE for fdx, 1000BASE-T hdx, 1000BASE-T fdx] (0x6cc3)
	    MAU type 100BASETX fdx (0x0010)
	  0x0000:  0012 0f01 036c c300 10
	Organization specific TLV (127), length 6: OUI IEEE 802.3 Private (0x00120f)
	  Max frame size Subtype (4)
	    MTU size 0
	  0x0000:  0012 0f04 0000
	End TLV (0), length 0
03:24:54.850436 LLDP, length 197
	Chassis ID TLV (1), length 7
	  Subtype MAC address (4): 00:22:15:58:80:0d (oui Unknown)
	  0x0000:  0400 2215 5880 0d
	Port ID TLV (2), length 7
	  Subtype MAC address (3): 00:22:15:58:80:0d (oui Unknown)
	  0x0000:  0300 2215 5880 0d
	Time to Live TLV (3), length 2: TTL 120s
	  0x0000:  0078
	System Name TLV (5), length 20: ubuntu.ubuntu-domain
	  0x0000:  7562 756e 7475 2e75 6275 6e74 752d 646f
	  0x0010:  6d61 696e
	System Description TLV (6), length 93
	  Ubuntu 12.04 LTS\0x0a Linux 3.2.0-38-generic-pae #61-Ubuntu SMP Tue Feb 19 12:39:51 UTC 2013 i686
	  0x0000:  5562 756e 7475 2031 322e 3034 204c 5453
	  0x0010:  0a20 4c69 6e75 7820 332e 322e 302d 3338
	  0x0020:  2d67 656e 6572 6963 2d70 6165 2023 3631
	  0x0030:  2d55 6275 6e74 7520 534d 5020 5475 6520
	  0x0040:  4665 6220 3139 2031 323a 3339 3a35 3120
	  0x0050:  5554 4320 3230 3133 2069 3638 36
	System Capabilities TLV (7), length 4
	  System  Capabilities [Bridge, WLAN AP, Router] (0x001c)
	  Enabled Capabilities [none] (0x0000)
	  0x0000:  001c 0000
	Management Address TLV (8), length 12
	  Management Address length 5, AFI IPv4 (1): ubuntu.local
	  Interface Index Interface Numbering (2): 2
	  0x0000:  0501 c0a8 0103 0200 0000 0200
	Port Description TLV (4), length 4: eth0
	  0x0000:  6574 6830
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  Link aggregation Subtype (3)
	    aggregation status [supported], aggregation port ID 0
	  0x0000:  0012 0f03 0100 0000 00
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  MAC/PHY configuration/status Subtype (1)
	    autonegotiation [supported, enabled] (0x03)
	    PMD autoneg capability [10BASE-T hdx, 10BASE-T fdx, 100BASE-TX hdx, 100BASE-TX fdx, Pause for fdx links, Asym PAUSE for fdx, 1000BASE-T hdx, 1000BASE-T fdx] (0x6cc3)
	    MAU type 100BASETX fdx (0x0010)
	  0x0000:  0012 0f01 036c c300 10
	Organization specific TLV (127), length 6: OUI IEEE 802.3 Private (0x00120f)
	  Max frame size Subtype (4)
	    MTU size 0
	  0x0000:  0012 0f04 0000
	End TLV (0), length 0

lldp packets from veth0 management address set to eth0

sudo /usr/sbin/lldpd -I veth0,veth1 -m 192.168.1.3
co2kara@ubuntu:/host/Users/co2kara/Documents/projects/stash$ !?tcp
sudo tcpdump -i veth0 ether proto 0x88cc -vv
tcpdump: listening on veth0, link-type EN10MB (Ethernet), capture size 65535 bytes
04:08:21.173470 LLDP, length 198
	Chassis ID TLV (1), length 7
	  Subtype MAC address (4): 36:78:78:9e:74:30 (oui Unknown)
	  0x0000:  0436 7878 9e74 30
	Port ID TLV (2), length 7
	  Subtype MAC address (3): 36:78:78:9e:74:30 (oui Unknown)
	  0x0000:  0336 7878 9e74 30
	Time to Live TLV (3), length 2: TTL 120s
	  0x0000:  0078
	System Name TLV (5), length 20: ubuntu.ubuntu-domain
	  0x0000:  7562 756e 7475 2e75 6275 6e74 752d 646f
	  0x0010:  6d61 696e
	System Description TLV (6), length 93
	  Ubuntu 12.04 LTS\0x0a Linux 3.2.0-38-generic-pae #61-Ubuntu SMP Tue Feb 19 12:39:51 UTC 2013 i686
	  0x0000:  5562 756e 7475 2031 322e 3034 204c 5453
	  0x0010:  0a20 4c69 6e75 7820 332e 322e 302d 3338
	  0x0020:  2d67 656e 6572 6963 2d70 6165 2023 3631
	  0x0030:  2d55 6275 6e74 7520 534d 5020 5475 6520
	  0x0040:  4665 6220 3139 2031 323a 3339 3a35 3120
	  0x0050:  5554 4320 3230 3133 2069 3638 36
	System Capabilities TLV (7), length 4
	  System  Capabilities [Bridge, WLAN AP, Router] (0x001c)
	  Enabled Capabilities [none] (0x0000)
	  0x0000:  001c 0000
	Management Address TLV (8), length 12
	  Management Address length 5, AFI IPv4 (1): ubuntu.local
	  Interface Index Interface Numbering (2): 2
	  0x0000:  0501 c0a8 0103 0200 0000 0200
	Port Description TLV (4), length 5: veth0
	  0x0000:  7665 7468 30
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  Link aggregation Subtype (3)
	    aggregation status [supported], aggregation port ID 0
	  0x0000:  0012 0f03 0100 0000 00
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  MAC/PHY configuration/status Subtype (1)
	    autonegotiation [none] (0x00)
	    PMD autoneg capability [unknown] (0x0000)
	    MAU type 10GBASER (0x0021)
	  0x0000:  0012 0f01 0000 0000 21
	Organization specific TLV (127), length 6: OUI IEEE 802.3 Private (0x00120f)
	  Max frame size Subtype (4)
	    MTU size 0
	  0x0000:  0012 0f04 0000
	End TLV (0), length 0
04:08:51.210101 LLDP, length 198
	Chassis ID TLV (1), length 7
	  Subtype MAC address (4): 36:78:78:9e:74:30 (oui Unknown)
	  0x0000:  0436 7878 9e74 30
	Port ID TLV (2), length 7
	  Subtype MAC address (3): 36:78:78:9e:74:30 (oui Unknown)
	  0x0000:  0336 7878 9e74 30
	Time to Live TLV (3), length 2: TTL 120s
	  0x0000:  0078
	System Name TLV (5), length 20: ubuntu.ubuntu-domain
	  0x0000:  7562 756e 7475 2e75 6275 6e74 752d 646f
	  0x0010:  6d61 696e
	System Description TLV (6), length 93
	  Ubuntu 12.04 LTS\0x0a Linux 3.2.0-38-generic-pae #61-Ubuntu SMP Tue Feb 19 12:39:51 UTC 2013 i686
	  0x0000:  5562 756e 7475 2031 322e 3034 204c 5453
	  0x0010:  0a20 4c69 6e75 7820 332e 322e 302d 3338
	  0x0020:  2d67 656e 6572 6963 2d70 6165 2023 3631
	  0x0030:  2d55 6275 6e74 7520 534d 5020 5475 6520
	  0x0040:  4665 6220 3139 2031 323a 3339 3a35 3120
	  0x0050:  5554 4320 3230 3133 2069 3638 36
	System Capabilities TLV (7), length 4
	  System  Capabilities [Bridge, WLAN AP, Router] (0x001c)
	  Enabled Capabilities [none] (0x0000)
	  0x0000:  001c 0000
	Management Address TLV (8), length 12
	  Management Address length 5, AFI IPv4 (1): ubuntu.local
	  Interface Index Interface Numbering (2): 2
	  0x0000:  0501 c0a8 0103 0200 0000 0200
	Port Description TLV (4), length 5: veth0
	  0x0000:  7665 7468 30
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  Link aggregation Subtype (3)
	    aggregation status [supported], aggregation port ID 0
	  0x0000:  0012 0f03 0100 0000 00
	Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
	  MAC/PHY configuration/status Subtype (1)
	    autonegotiation [none] (0x00)
	    PMD autoneg capability [unknown] (0x0000)
	    MAU type 10GBASER (0x0021)
	  0x0000:  0012 0f01 0000 0000 21
	Organization specific TLV (127), length 6: OUI IEEE 802.3 Private (0x00120f)
	  Max frame size Subtype (4)
	    MTU size 0
	  0x0000:  0012 0f04 0000
	End TLV (0), length 0
	

configuration of veth0

veth0     Link encap:Ethernet  HWaddr 36:78:78:9e:74:30  
          inet addr:192.168.1.10  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: fe80::3478:78ff:fe9e:7430/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:53 errors:0 dropped:0 overruns:0 frame:0
          TX packets:93 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10480 (10.4 KB)  TX bytes:19181 (19.1 KB)

Service?

Some common services Mongo DB, MySQL, PostgreSQL, RabbitMQ, Redis Memcached, Apache.
To run a service we use a runtime environment.
Runtimes Java 1.7, Nodejs 0.8, Ruby 1.8.7, Ruby 1.9.3
How do we specify a service?
Maybe through a manifest file { :vendor => 'MySQL', :version => '5.0' }

Some common operations on service

  • Add/delete bind an application into a service.
  • Bind an application => create and install an application into a service.

Some common operations on applications

  • All applications should have owner identification.
  • An application may use one or more service.
  • An application has state information that needs to saved/restored.
  • Start (multiple instances ) stop restart an application, Run multiple instances Bind/Unbind it from the service.
  • Scale (memory,disk space) and if unable migrate applications from one VM to another.
  • Retrieve application stats or log information

Puppet and Chef

Both tools are designed to control applications in a client/server (master/agent) environment.
Server is the central store.
Clients get and store configuration information from the server and run on separate hosts.
When clients start they authenticate with the server using certificates.
When the client connects to the server, the server downloads configuration data to client.
Clients can sent notifications to server.
Both provide REST-ful APIs for server and client. Both tools are written in Ruby therefore there is no C API but we could use C to call the REST-ful provided API's. Is the API adequate for all operations we would like to perform? Chef's looks complete Puppet's not so comprehensive.

Some information about puppet

Puppet agent collects information about running host and passes such information to server.
Puppet has its own declarative language Resource Abstraction Language. Its syntax is easy to understand.
First we declare a resource and define a class to manage it.
Resources in Puppet are structured objects such as file, package, and service.
Puppet supports git commands like for example puppet agent. Puppet internal components facter. A simple tool to discover information about a running host. Can be extended to discover custom data.
Puppets declarative language harder to write while Chef receipes are plain ruby code.
Puppet is written in Ruby developed and maintained by Puppet Labs.
Pupppet installed under the /var/lib/puppet.
Resource data is saved under the above directory.

Some information about Chef

For the Chef terminology nodes are environments where Chef clients reside.
Chef - three versions available

  1. Hosted Chef
  2. Private Chef
  3. Open Source Chef Server

Chef uses ohai gem to gather system information and report such information into Chef Client.
Chef also provides an indexing services. All information gathered about the resources managed by Chef are indexed and searchable.

In terms of configuration I find the Chef easier to configure than puppet. Multiple resources can be defined and run using both tools. Puppet reorders the execution of resources while Chef maintains a sequential order.
Chef resides inside the OpenStack framework and supports some already developed cookbooks (ie. compute nova).

Where Puppet/Chef should be installed?

Clients instances should be installed on the server that houses lots of VMs.
Server instances should be installed on the same machine where the server manager process is running.

Other tools

CloudFoundry. A Ruby api to manage applications
http://rexify.org/api/index.html Rexify a perl solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment