8021x-wired-testing.txt (3158B)
1 Virtual Ethernet Device 2 ======================= 3 4 Virtual Ethernet device pairs are a pair of fake Ethernet devices that act 5 as a pipe, Traffic sent via one interface comes out the other. As these are 6 Ethernet devices and not point to point devices you can handle broadcast 7 traffic on these interfaces and use protocols other than IP. 8 9 To create a virtual ethernet pipe with one end called veth0 and the other 10 called veth1, use the following command: 11 12 sudo ip link add veth0 type veth peer name veth1 13 14 The pair of interfaces are identical and act as a dumb pipe, there is no 15 master or slave end. Deleting either end will cause both interfaces to be 16 deleted. The pair of interfaces implement carrier detection and can tell 17 when one side of the link is in the 'DOWN' state. if the other link is in 18 the 'DOWN' state it will indicate 'NO-CARRIER' until the other end is 19 brought up: 20 21 sudo ip link set veth0 up 22 sudo ip link set veth1 up 23 24 25 Testing 802.1x on Virtual Ethernet Device 26 ========================================= 27 28 It is based on hostapd and wpa_supplicant. To compile them, go in the 29 hostapd/wpa_supplicant directory, copy "defconfig" to ".config", for 30 hostapd uncomment the line "CONFIG_DRIVER_WIRED=y" and "make". 31 32 Using hostapd (the authenticator) and following hostapd.conf file: 33 34 interface=veth0 35 driver=wired 36 ieee8021x=1 37 use_pae_group_addr=1 38 eap_server=1 39 eap_user_file=hostapd.eap_user # replace with the right path 40 ca_cert=newcertca.crt # replace with your CA certificate path 41 server_cert=newcertca.crt # replace with your server certificate path (here I use the same as for the CA for simplicity) 42 private_key=newkeyca.key # replace with your server private key path 43 44 A sample hostapd.eap_user that works is the following: 45 46 # Phase 1 users 47 * PEAP 48 # Phase 2 49 "test" MSCHAPV2 "password" [2] 50 51 To execute hostapd (add "-dd" for debug mode): 52 53 sudo ./hostapd hostapd.conf 54 55 Using wpa_supplicant (the supplicant, i.e., the client) with the following 56 wpa_supplicant.conf configuration file: 57 58 ap_scan=0 59 fast_reauth=1 60 network={ 61 ssid="" 62 scan_ssid=0 63 key_mgmt=IEEE8021X 64 eap=PEAP 65 phase2="auth=MSCHAPV2" 66 identity="test" 67 password="password" 68 ca_cert="newcertca.crt" # replace with your CA certificate path 69 } 70 71 To run wpa_supplicant (add "-dd -K" for debugging): 72 73 sudo ./wpa_supplicant -iveth1 -c./wpa_supplicant.conf -Dwired 74 75 76 Running Authenticator in a network namespace 77 ============================================ 78 79 In some cases it might be useful to run hostapd in a network namespace to 80 provide real separation between the two network interfaces. First create 81 the "hostap" named network namespace: 82 83 sudo ip netns add hostap 84 85 Now move the network interface of hostapd into the "hostap" named network 86 namespace: 87 88 sudo ip link set veth0 netns hostap 89 90 Inside the "hostap" named network namespace the loopback interface needs 91 to be brought up and also the network interface: 92 93 sudo ip netns exec hostap ip link set lo up 94 sudo ip netns exec hostap ip link set veth0 up 95 96 Then execute hostapd inside the network namespace: 97 98 sudo ip netns exec hostap ./hostapd wired_hostapd.conf 99 100 After that run wpa_supplicant as described above.