Kristoffer Plagborg Bak Sørensen
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: "Computer Network" --- # Workshop 1: Configuring IPv4 and IPv6 ### Kristoffer Plagborg Bak Sørensen, 201908140 ### Pernille Sonne Pallesen, 201909457 [ [Back to Root page](https://github.com/rhjacobsen/CN_workshops/blob/master/README.md) ] This workshop consists of two parts. The first part is dealing with IPv4 static address configuration, address resolution (ARP), and autoconfiguration (DHCP). The second part is dealing with IPv6 autoconfiguration and address resolution which is part of the Neighbour Discovery Protocol (NDP). The overall goal of the workshop is to consolidate the material that has been covered in the lectures on IPv4 and IPv6 and get some experience working with basic IP concepts in practice. ## Lab overview ### Setup <center><img src="https://raw.githubusercontent.com/rhjacobsen/CN_workshops/master/Workshops/1/imgs/LAB01.png" width="800"></img></center> ### Networks | Name | Network |--------------|-------------------------- | Shannon | 10.0.0.0 / 24 | Shannon | 2001:16d8:dd92:1001::0 /64 ## Creating and Setting up the Laboratory The same GNS3 project is used for all experiments. The first step is to create the project. * Start GNS3 and create (or open an existing) project <sup>1</sup> * Add an Ethernet Switch, two Nodes (Hosts), and a Router * Connect them as shown in the figure above * Save the project <sup>2</sup> * Start all devices, wait until all links are green * Right click a link, and choose _start capture_, Wireshark protocol analyzer should start #### Notes: ``` 1) You man need to run GNS3 as administrator for the environment to have access to the virtual server. 2) Configurations that you have typed are not persistently stored when you close a project. ``` ## Part 1: IPv4 Configuration and Address Resolution The objective of these experiments is to configure the network with IPv4 addresses using static and dynamic address configuration applying the Dynamic Host Configuration Protocol (DHCP), and observe the behaviour of the ARP and ICMP protocols. DHCP can be used to configure more than just IP-addresses, but for simplicity this will not be covered in this workshop. The experiments consists of the following steps. When asked to fill in information, do so before continuing to the next step. ### Step 1: Static IPv4 Address Configuration * Login to "Router-1" and configure it with the IPv4 address 10.0.0.1 using the command: ``` ip addr add 10.0.0.1/24 dev eth0 ip link set eth0 up ``` * Login to "Node-1", and configure it with the IPv4 address 10.0.0.2 using the command: ``` ip addr add 10.0.0.2/24 dev eth0 ip link set eth0 up ``` * Verify the settings via ``` ip addr show eth0 ``` ### Step 2: Observe ARP and Ping Packets * From "Router-1" ping "Node-1" 5 times: ``` # Send 5 ping packets to 10.0.0.2 ping -c 5 10.0.0.2 ``` > ##### Challenge 1.1 > Identify the ARP and Ping packets captured by Wireshark. Briefly explain the flow of the ARP and Ping packets that have been sent and received as an effect of the ping-command: > ``` > The ping command uses the ICMP protocol and sends a ICMP request > message to PC1. PC1 receives this message, and replies back using the > ICMP reply message, to notify the sender that it is reachable. > This back and forth communication is repeated 5 times, as the ping > command runs 5 iterations. > > To make sure that the IP has not changed in the meanwhile, the > ARP-protocol runs. If it has changed, the IP-MAC-mapping can be > updated. > ``` ![challenge 1.1 topology](https://i.imgur.com/V4Vbrkr.png) ![challenge 1.1](https://i.imgur.com/7QGRgrV.png) ### Step 3: Setup DHCP Server * Create the file /etc/dhcpd.conf and add the content: ``` # For more info look in /etc/dhcp/dhcpd.conf.example default-lease-time 600; max-lease-time 7200; subnet 10.0.0.0 netmask 255.255.255.0 { range 10.0.0.3 10.0.0.255; } ``` * This tells the DHCP server to configure the network 10.0.0.0 with the netmask 255.255.255.0 such that addresses ranging from 10.0.0.3 to 10.0.0.255 are assigned to Nodes. * Start the DHCP server: ``` # man https://linux.die.net/man/8/dhcpd /usr/sbin/dhcpd -4 -f -d eth0 ``` ### Step 4: Automatic IPv4 Address Configuration * Login to "Node-2", and run the command ``` # Start the DHCP client for autoconfiguration of eth0. dhclient eth0 ``` > ##### Challenge 1.2 > Identify the DHCP packets by using packet capture, and briefly explain the exchange of DHCP packets. What IPv4 address has been assigned to "Node-2"? > ``` > Node 2 sends a DHCP request, and recieves a DHCP acknowledgement > from the router where the DHCP server is. > > The IPv4 adress assigned to Node-2 is 10.0.0.3, since it is the > smallest IP adress in the range that is availible. > ``` * Finally, try to ping both "Node-1" and "Router-1", in order to see if the network has been configured successfully. If all nodes can ping each other you have successfully completed Part 1. ## Part 2: IPv6 autoconfiguration The objective of these experiments is to observe how stateless IPv6 autoconfiguration and Neighbour Discovery Protocol (NDP) works. Start this part by opening the project that was created in the beginning of the workshop and connect WireShark to the switch (or a hub). The experiments consists of the three steps below. When asked to fill in information, do so before continuing to the next step. ### Step 1: Configure IPv6 router with autoconfiguration In order to see how IPv6 autoconfiguration works with a router present, we need to configure the Router Advertisement Daemon (radvd) on the router node: * Login to the "Router-1" node and assign an IPv6 address to eth0 of the router by issuing the following command: ``` ip addr add 2001:16d8:dd92:1001::1/64 dev eth0 ip link set eth0 up ``` * Edit /etc/radvd.conf using the _nano editor_ (or vim if you prefer), so that it contains the following: ``` interface eth0 { AdvSendAdvert on; prefix 2001:16d8:dd92:1001::/64 { }; }; ``` This tells the radvd daemon to send out router advertisements on interface 0, containing the prefix 2001:16d8:dd92:1001::/64. * Start the radvd daemon by: ``` /usr/sbin/radvd -n ``` In Wireshark you will now see a number of router advertisements. ### Step 2: Configure Hosts using Autoconfiguration We now have a node on the network which acts as an IPv6 router. Next step is to see how the two hosts (Node-1 and Node-2) can be autoconfigured using the prefix advertised by the IPv6 router. * Login to Node-1 and bring up the eth0 interface using: ``` ip link set eth0 up ``` * Inspect the interface by typing: ``` ip addr show eth0 ``` > ##### Challenge 1.3 > What IPv6 addresses are configured for the interface prior to autoconfiguration? > ``` > On Node-1 the IPv6 address prior to autoconfiguration is: > fe80::40:2ff:fe31:47e7/64 > ``` * Enable IPv6 autoconfiguration and Duplicate Address Detection by issuing the following 4 commands: ``` sysctl -w net.ipv6.conf.eth0.autoconf=1 sysctl -w net.ipv6.conf.eth0.dad_transmits=1 sysctl -w net.ipv6.conf.eth0.accept_ra=1 sysctl -w net.ipv6.conf.eth0.router_solicitations=3 ``` * Force autoconfiguration by bringing the interface down and up again: ``` ip link set eth0 down ip link set eth0 up ``` * Inspect Wireshark * Inspect the interface by typing: ``` ip addr show eth0 ``` > ##### Challenge 1.4 > What IPv6 addresses are configured for eth0? > ``` > On Node-1 the IPv6 addresses afterconfiguration are: > 2001:16d8:dd92:1001:40:2ff:fe31:47e7/64 > fe80::40:2ff:fe31:47e7/64 > > ``` > ##### Challenge 1.5 > What is the IPv6-network address (prefix) announced by the Router? Explain how you can identify this address? > ``` > In the first IPv6 adress in the previous question, we see that it > has a prefix from the router. > We can find this prefix in wireshark when looking at the router > advertisement message. It says: > ICMPv6 Option(Prefix information : 2001:16d8:dd92:1001:/64) > > ``` ![](https://i.imgur.com/FTo9KAs.png) * > ##### Challenge 1.6 > Briefly explain the ICMPv6 packets capture by Wireshark. You can ignore packets destined for ff02::16. > ``` > There are three different packets: > Router solicitation, Router advertisement, Neighbor solicitation. > > Router solicitation: A host sends this message to make the router > immidiately reply with a router advertisement message, rather than > at the shceduled time. > > Router advertisement: The router sends this message to advertise > its presence on the link. The message includes information about > itself, e.g. its prefix. > > Neighbor solicitation: This is used by nodes to aquire information > from other nodes rather than asking the router. This could be > determining the link-layer address of a neighbor or checking the > validity of an already existing address. > ``` * Ping the router (2001:16d8:dd92:1001::1): ``` ping6 -c 5 2001:16d8:dd92:1001::1 ``` > ##### Challenge 1.7 > Briefly explain the ICMPv6 packets exchanged. > ``` > The ping command uses the ICMP protocol and sends an ICMP echo > request message to the router from Node-1. > The router receives this message, and replies back using the > ICMP echo reply message, to notify the sender that it is reachable. > This back and forth communication is repeated 5 times, as the ping > command runs 5 iterations. > > Then, Node-1 send Neighbor solicitation to the router, and the > router does the samen for Node-1. > Then they both send Neighbor advertisement to advertise their > presence and share information about themselves. > ``` ![](https://i.imgur.com/pLMmezO.png) ### Step 3: IPv6 address calculation Having configured one of the hosts using IPv6 autoconfiguration, the final step is to predict the IPv6 address that will be assigned to the other node. Recall that the EUI-64 identifier is calculated from the MAC-address by taking the lower 24-bits and the upper 24-bits and inserting FF:FE between them and inverting the UL-bit. The EUI-64 identifier is then used together with the network prefix to construct the global unicast address. An example: MAC address: 00:B0:D0:66:6F:54 Network prefix: 2001:1:1:1::/64 EUI-64: 02:B0:D0:FF:FE:66:6F:54 Global unicast: 2001:1:1:1::02B0:D0FF:FE66:6F54 * Login to Node-2 and obtain the MAC-address by running ``` ip link show eth0 ``` > ##### Challenge 1.8 > Calculate the global unicast IPv6 address from the MAC-address and the prefix which the router is configured for. > ``` > MAC: 82:B0:79:8A:D6:C8 > > Network Prefix: 2001:16D8:DD92:1001::/64 > > EUI-64: 82:B0:79:FF:FE:8A:D6:C8 > > Global Unicast: 2001:16D8:DD92:1001::82B0:79FF:FE8A:D6C8 > ``` * Enable IPv6 autoconfiguration and Duplicate Address Detection by issuing the following 4 commands: ``` sysctl -w net.ipv6.conf.eth0.autoconf=1 sysctl -w net.ipv6.conf.eth0.dad_transmits=1 sysctl -w net.ipv6.conf.eth0.accept_ra=1 sysctl -w net.ipv6.conf.eth0.router_solicitations=3 ``` * Force autoconfiguration by bringing the interface down and up again: ``` ip link set eth0 down ip link set eth0 up ``` * Inspect the assigned IPv6-addresses. Does the address configured for the interface match the one calculated? If not try to calculate it again. ``` ip addr show eth0 ``` * As a final test, ping the node which was autoconfigured using the command (replacing the x's with the address): ``` ping6 -c 5 xxxx:xxxx:xxxx:xxxx::x ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully