--- layout: post title: "Internet sharing (ipv4 and ipv6) on archlinux using dnsmasq" date: 2014-02-08 20:02:22 +0100 comments: true categories: - arch - dhcp - ipv6 router advertisement --- **Update:** Added adhoc wlan network A guide to connect with a different machine using a ethernet cable for internet sharing or just transferring files: 1. Install dnsmasq and iproute2 $ pacman -S dnsmasq iproute2 2. Copy over the configuration files at the end of the article and edit the */etc/conf.d/share-internet@\* to match your network setup. (where \ is your network device) 3. Start the sharing service with systemd $ sudo systemctl start internet-sharing@.service After that the other machine can connect via dhcp. It will get an ipv4 address from the **10.20.0.0/24** subnet and a ipv6 address from the **fd21:30c2:dd2f::** subnet. Your host will be reachable via **10.20.0.1** or **fd21:30c2:dd2f::1**. Thanks to ipv6 router advertising, an AAAA record for each host is automatically set based on the hostname. This means if your hostname is *foo*, all members of the network can just connect to it using the address *foo*. You should disable the share-internet.service, if you don't need it. Otherwise you might mess up network setups, if you connect to a network with the device on which the dhcp service is running. Happy networking! {% include_code /etc/systemd/system/share-internet.service lang:ini share-internet/share-internet.service %} {% include_code /etc/dnsmasq.conf lang:ini share-internet/dnsmasq.conf %} Ethernet to Wlan: {% include_code /etc/conf.d/share-internet@enp0s25 lang:bash share-internet/share-internet@enp0s25 %} Wlan to Ethernet: If you have luck and your wifi driver is capable of the infrastructure mode, you should take a look at hostadp, in my case I have to create an adhoc network. To enable the adhoc network: $ sudo systemctl enable wireless-adhoc@\.service {% include_code /etc/conf.d/share-internet@wlp3s0 lang:bash share-internet/share-internet@wlp3s0 %} {% include_code /etc/systemd/system/wireless-adhoc@.service lang:ini share-internet/wireless-adhoc@.service %} {% include_code /etc/wpa_supplicant/wpa_supplicant-adhoc-wlp3s0.conf lang:bash share-internet/wpa_supplicant-adhoc-wlp3s0.conf %}