Last active
April 18, 2019 13:57
-
-
Save monprin/1bf14f8e44e8831dedc53b6b0219a9b4 to your computer and use it in GitHub Desktop.
Wireguard Ubuntu Info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uname results: | |
Linux wg-test 4.18.0-17-generic #18-Ubuntu SMP Wed Mar 13 14:34:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux | |
Testing normal namespace... | |
Requested wg info: | |
default via 142.93.144.1 dev ens3 proto static | |
10.20.0.0/16 dev ens3 proto kernel scope link src 10.20.0.5 | |
10.20.0.0/16 via 10.20.0.1 dev ens3 proto static | |
142.93.144.0/20 dev ens3 proto kernel scope link src 142.93.153.56 | |
broadcast 10.20.0.0 dev ens3 table local proto kernel scope link src 10.20.0.5 | |
local 10.20.0.5 dev ens3 table local proto kernel scope host src 10.20.0.5 | |
broadcast 10.20.255.255 dev ens3 table local proto kernel scope link src 10.20.0.5 | |
local 10.99.93.13 dev wg0 table local proto kernel scope host src 10.99.93.13 | |
broadcast 127.0.0.0 dev lo table local proto kernel scope link src 127.0.0.1 | |
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1 | |
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1 | |
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1 | |
broadcast 142.93.144.0 dev ens3 table local proto kernel scope link src 142.93.153.56 | |
local 142.93.153.56 dev ens3 table local proto kernel scope host src 142.93.153.56 | |
broadcast 142.93.159.255 dev ens3 table local proto kernel scope link src 142.93.153.56 | |
::1 dev lo proto kernel metric 256 pref medium | |
fc00:bbbb:bbbb:bb01::5d0d dev wg0 proto kernel metric 256 pref medium | |
fe80::/64 dev ens3 proto kernel metric 256 pref medium | |
local ::1 dev lo table local proto kernel metric 0 pref medium | |
local fc00:bbbb:bbbb:bb01::5d0d dev wg0 table local proto kernel metric 0 pref medium | |
local fe80::c002:7dff:fe75:d43c dev ens3 table local proto kernel metric 0 pref medium | |
ff00::/8 dev ens3 table local metric 256 pref medium | |
ff00::/8 dev wg0 table local metric 256 pref medium | |
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 | |
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 | |
inet 127.0.0.1/8 scope host lo | |
valid_lft forever preferred_lft forever | |
inet6 ::1/128 scope host | |
valid_lft forever preferred_lft forever | |
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 | |
link/ether c2:02:7d:75:d4:3c brd ff:ff:ff:ff:ff:ff | |
inet 142.93.153.56/20 brd 142.93.159.255 scope global ens3 | |
valid_lft forever preferred_lft forever | |
inet 10.20.0.5/16 brd 10.20.255.255 scope global ens3 | |
valid_lft forever preferred_lft forever | |
inet6 fe80::c002:7dff:fe75:d43c/64 scope link | |
valid_lft forever preferred_lft forever | |
7: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000 | |
link/none | |
inet 10.99.93.13/32 scope global wg0 | |
valid_lft forever preferred_lft forever | |
inet6 fc00:bbbb:bbbb:bb01::5d0d/128 scope global | |
valid_lft forever preferred_lft forever | |
0: from all lookup local | |
32766: from all lookup main | |
32767: from all lookup default | |
inet lo forwarding off rp_filter off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet ens3 forwarding off rp_filter strict mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet wg0 forwarding off rp_filter strict mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet all forwarding off rp_filter strict mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet default forwarding off rp_filter strict mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 lo forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 ens3 forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 wg0 forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 all forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 default forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
interface: wg0 | |
public key: <mullvad_public_key> | |
private key: (hidden) | |
listening port: 60598 | |
peer: <mullvad_thing> | |
endpoint: 193.148.18.210:51820 | |
allowed ips: 0.0.0.0/0, ::/0 | |
Get google in default interface: | |
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> | |
<TITLE>301 Moved</TITLE></HEAD><BODY> | |
<H1>301 Moved</H1> | |
The document has moved | |
<A HREF="http://www.google.com/">here</A>. | |
</BODY></HTML> | |
Get google in wg interface: | |
curl: (28) Connection timed out after 10001 milliseconds | |
am.i.mullvad.net in default interface: | |
142.93.153.56 | |
am.i.mullvad.net in wg interface: | |
curl: (28) Connection timed out after 10001 milliseconds | |
Testing new namespace... | |
Requested wg info: | |
local 10.99.93.13 dev wg0 table local proto kernel scope host src 10.99.93.13 | |
fc00:bbbb:bbbb:bb01::5d0d dev wg0 proto kernel metric 256 pref medium | |
local fc00:bbbb:bbbb:bb01::5d0d dev wg0 table local proto kernel metric 0 pref medium | |
ff00::/8 dev wg0 table local metric 256 pref medium | |
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000 | |
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 | |
8: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000 | |
link/none | |
inet 10.99.93.13/32 scope global wg0 | |
valid_lft forever preferred_lft forever | |
inet6 fc00:bbbb:bbbb:bb01::5d0d/128 scope global | |
valid_lft forever preferred_lft forever | |
0: from all lookup local | |
32766: from all lookup main | |
32767: from all lookup default | |
inet lo forwarding off rp_filter strict mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet wg0 forwarding off rp_filter strict mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet all forwarding off rp_filter strict mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet default forwarding off rp_filter strict mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 lo forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 wg0 forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 all forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
inet6 default forwarding off mc_forwarding off proxy_neigh off ignore_routes_with_linkdown off | |
interface: wg0 | |
public key: <mullvad_public_key> | |
private key: (hidden) | |
listening port: 57582 | |
peer: <mullvad_thing> | |
endpoint: 193.148.18.210:51820 | |
allowed ips: 0.0.0.0/0, ::/0 | |
Get google in default interface: | |
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> | |
<TITLE>301 Moved</TITLE></HEAD><BODY> | |
<H1>301 Moved</H1> | |
The document has moved | |
<A HREF="http://www.google.com/">here</A>. | |
</BODY></HTML> | |
Get google in wg interface: | |
curl: (28) Connection timed out after 10001 milliseconds | |
am.i.mullvad.net in default interface: | |
142.93.153.56 | |
am.i.mullvad.net in wg interface: | |
curl: (6) Could not resolve host: am.i.mullvad.net # This is because I didn't setup DNS for the test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Show the system information | |
printf "uname results:\n%s\n\n" "$(uname -a)" | |
# Setup the conf files | |
mkdir -p /etc/wireguard | |
printf "%s" "[Interface] | |
PrivateKey = <mullvad_private_key> | |
#Address = 10.99.93.13/32,fc00:bbbb:bbbb:bb01::5d0d/128 | |
#DNS = 193.138.218.74 | |
[Peer] | |
PublicKey = <mullvad_public_key> | |
AllowedIPs = 0.0.0.0/0,::0/0 | |
Endpoint = 193.148.18.210:51820" > /etc/wireguard/mullvad.conf | |
chown root:root /etc/wireguard/* | |
chmod 600 /etc/wireguard/* | |
# Run it in the default namespace | |
printf "%s\n" "Testing normal namespace..." | |
ip link add wg0 type wireguard | |
ip address add dev wg0 10.99.93.13/32 | |
ip address add dev wg0 fc00:bbbb:bbbb:bb01::5d0d/128 | |
wg setconf wg0 /etc/wireguard/mullvad.conf | |
ip link set up dev wg0 | |
# Test this interface | |
printf "%s\n" "Requested wg info:" | |
ip route show table all; ip addr show; ip rule show; iptables-save; ip netconf; wg; | |
printf "\n%s\n" "Get google in default interface:" | |
curl -sSm 10 172.217.2.46 | |
printf "\n%s\n" "Get google in wg interface:" | |
curl -sSm 10 --interface wg0 172.217.2.46 | |
printf "\n%s\n" "am.i.mullvad.net in default interface:" | |
curl -sSm 10 https://am.i.mullvad.net | |
printf "\n%s\n" "am.i.mullvad.net in wg interface:" | |
curl -sSm 10 --interface wg0 https://am.i.mullvad.net | |
printf "%s\n\n" "" | |
# Cleanup | |
ip link delete wg0 | |
# Run it in a separate namespace | |
printf "%s\n" "Testing new namespace..." | |
ip netns add container | |
ip link add wg0 type wireguard | |
ip link set wg0 netns container | |
ip -n container address add 10.99.93.13/32 dev wg0 | |
ip -n container address add fc00:bbbb:bbbb:bb01::5d0d/128 dev wg0 | |
ip netns exec container wg setconf wg0 /etc/wireguard/mullvad.conf | |
ip -n container link set wg0 up | |
# Test this interface | |
printf "%s\n" "Requested wg info:" | |
ip netns exec container ip route show table all | |
ip netns exec container ip addr show | |
ip netns exec container ip rule show | |
ip netns exec container iptables-save | |
ip netns exec container ip netconf | |
ip netns exec container wg | |
printf "\n%s\n" "Get google in default interface:" | |
curl -sSm 10 172.217.2.46 | |
printf "\n%s\n" "Get google in wg interface:" | |
ip netns exec container curl -sSm 10 --interface wg0 172.217.2.46 | |
printf "\n%s\n" "am.i.mullvad.net in default interface:" | |
curl -sSm 10 https://am.i.mullvad.net | |
printf "\n%s\n" "am.i.mullvad.net in wg interface:" | |
ip netns exec container curl -sSm 10 --interface wg0 https://am.i.mullvad.net | |
printf "%s\n\n" "" | |
# Cleanup | |
ip netns delete container |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment