Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

How to use wireguard under gentoo

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
12 posts • Page 1 of 1
Author
Message
wenzi
Tux's lil' helper
Tux's lil' helper
Posts: 106
Joined: Fri Jan 18, 2019 3:39 am

How to use wireguard under gentoo

  • Quote

Post by wenzi » Thu Oct 05, 2023 6:30 am

I install wireguard-tools, and copy the wg0.conf file to /etc/wireguard/, when I use wg-quick up wg0 ,it does not work , here is the message

Code: Select all

[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 172.16.0.2/32 dev wg0
[#] ip -6 address add 2606:4700:110:8a5a:c842:4772:a834:c25/128 dev wg0
[#] ip link set mtu 1280 up dev wg0
[#] resolvconf -a wg0 -m 0 -x
[#] ip -6 route add ::/1 dev wg0
[#] ip -6 route add 8000::/1 dev wg0
[#] ip -4 route add 128.0.0.0/1 dev wg0
[#] ip -4 route add 0.0.0.0/1 dev wg0
But ,under archlinux, do the same it works,and get this message

Code: Select all

[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 172.16.0.2/32 dev wg0
[#] ip -6 address add 2606:4700:110:8781:b756:22e:199e:87e7/128 dev wg0
[#] ip link set mtu 1280 up dev wg0
[#] resolvconf -a wg0 -m 0 -x
[#] wg set wg0 fwmark 51820
[#] ip -6 route add ::/0 dev wg0 table 51820
[#] ip -6 rule add not fwmark 51820 table 51820
[#] ip -6 rule add table main suppress_prefixlength 0
[#] nft -f /dev/fd/63
[#] ip -4 route add 0.0.0.0/0 dev wg0 table 51820
[#] ip -4 rule add not fwmark 51820 table 51820
[#] ip -4 rule add table main suppress_prefixlength 0
[#] sysctl -q net.ipv4.conf.all.src_valid_mark=1
[#] nft -f /dev/fd/63
[#] export PRIORITY=1024; source /etc/wireguard/hooks/post-up.sh
Add rules...
Add rules done.

[Moderator edit: added [code] tags to preserve output layout. -- pietinger]
Top
pietinger
Moderator
Moderator
Posts: 6608
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Thu Oct 05, 2023 10:33 am

It seems to me that archlinux is doing additionally some settings for a firewall, but the treatment of the network specific operations is identical. You might do this also with nftables.
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Thu Oct 05, 2023 10:42 am

So, in what what it doesn't work?
Do you use the same config files for wireguard on both systems?

Is your interface configured?
Routing rules?
Firewall?
Does your internet cut off after connecting?
Top
wenzi
Tux's lil' helper
Tux's lil' helper
Posts: 106
Joined: Fri Jan 18, 2019 3:39 am

  • Quote

Post by wenzi » Thu Oct 05, 2023 10:48 am

szatox wrote:So, in what what it doesn't work?
Do you use the same config files for wireguard on both systems?

Is your interface configured?
Routing rules?
Firewall?
Does your internet cut off after connecting?
works means I can connect the internet pass through the wireguard vpn ,I do not use firewall both archlinux and gentoo, and I use the same file wg0.confg
Top
wenzi
Tux's lil' helper
Tux's lil' helper
Posts: 106
Joined: Fri Jan 18, 2019 3:39 am

  • Quote

Post by wenzi » Thu Oct 05, 2023 10:51 am

pietinger wrote:It seems to me that archlinux is doing additionally some settings for a firewall, but the treatment of the network specific operations is identical. You might do this also with nftables.
I think the wg-quick can automatic set nftables rules according to the wg0.conf ,but I don't khow why gentoo can not do this
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Thu Oct 05, 2023 11:15 am

Man, that's 100% non-answer to the questions asked.
A bus can fail to deliver you from location A to B due to a flat tire, empty tank, exploded engine, a drunk driver, or a million other reasons. Do you get where I'm going with it?

Divination services come at premium prices, so give us something to work with if you want to get help.
What have you done so far to diagnose it and what are the results?
Top
wenzi
Tux's lil' helper
Tux's lil' helper
Posts: 106
Joined: Fri Jan 18, 2019 3:39 am

  • Quote

Post by wenzi » Thu Oct 05, 2023 11:49 am

szatox wrote:Man, that's 100% non-answer to the questions asked.
A bus can fail to deliver you from location A to B due to a flat tire, empty tank, exploded engine, a drunk driver, or a million other reasons. Do you get where I'm going with it?

Divination services come at premium prices, so give us something to work with if you want to get help.
What have you done so far to diagnose it and what are the results?
I don't khow what can I provide ,there is no error message , and what I need do ?
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Thu Oct 05, 2023 12:47 pm

Sorry to ask,
How far are you from Gentoo Wiki?
Thks 4 ur attention, interest & support.
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Top
Hu
Administrator
Administrator
Posts: 24380
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Oct 05, 2023 3:12 pm

If there is no error message, how do you know it is not working? Please give us a simple command that you expect to work, which does not work, and the full output it produces. For example, curl -v https://www.gentoo.org/ should download the Gentoo home page. Does it? If not, what does it show instead?
Top
wenzi
Tux's lil' helper
Tux's lil' helper
Posts: 106
Joined: Fri Jan 18, 2019 3:39 am

  • Quote

Post by wenzi » Fri Oct 06, 2023 4:40 am

CaptainBlood wrote:Sorry to ask,
How far are you from Gentoo Wiki?
Thks 4 ur attention, interest & support.
yes I fellow the wiki, and get the configfile from cloudflare,here is the config file

Code: Select all

[Interface]
PrivateKey = kGP8SHrruq90+0VxU6Y5aK/RzYbACJM5bwjoup513lw=
Address = 172.16.0.2/32, 2606:4700:110:8a5a:c842:4772:a834:c25/128
DNS = 1.1.1.1, 1.0.0.1
MTU = 1280

[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
AllowedIPs = 0.0.0.0/1, 128.0.0.0/1, ::/1, 8000::/1
Endpoint = 162.159.192.247:5956
put the file in /etc/wireguard/ and start the vpn with

Code: Select all

wg-quick up wg0
Top
hdcg
Tux's lil' helper
Tux's lil' helper
Posts: 122
Joined: Sun Apr 07, 2013 8:30 am

  • Quote

Post by hdcg » Fri Oct 06, 2023 5:31 am

Hello wenzi,

first of all be careful about the information you share. It looks like you just shared your private key. If this is really your private key, make sure to invalidate your current Cloudflare config and create a new one!

As mentioned in the other posts, the general wireguard setup looks fine and it connects. The difference is most likely your network configuration.
I did a peek at the wg-quick script and it performs specific steps (e.g. the "sysctl -q net.ipv4.conf.all.src_valid_mark=1" you see under Arch) depending on the network configuration.

Beside the answer to the question from Hu, can you please provide the output of

Code: Select all

ifconfig -a
for your Gentoo environment as well as for your Arch environment. This may give us a lead.

Best Regards,
Holger
Top
wenzi
Tux's lil' helper
Tux's lil' helper
Posts: 106
Joined: Fri Jan 18, 2019 3:39 am

  • Quote

Post by wenzi » Fri Oct 06, 2023 5:44 am

hdcg wrote:Hello wenzi,

first of all be careful about the information you share. It looks like you just shared your private key. If this is really your private key, make sure to invalidate your current Cloudflare config and create a new one!

As mentioned in the other posts, the general wireguard setup looks fine and it connects. The difference is most likely your network configuration.
I did a peek at the wg-quick script and it performs specific steps (e.g. the "sysctl -q net.ipv4.conf.all.src_valid_mark=1" you see under Arch) depending on the network configuration.

Beside the answer to the question from Hu, can you please provide the output of

Code: Select all

ifconfig -a
for your Gentoo environment as well as for your Arch environment. This may give us a lead.

Best Regards,
Holger
THANKS, after I update the system to the lastest ,everything works fine, :lol: I realy don't khow why? thanks everybady for my help, THANKS!!
Top
Post Reply

12 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy