User Tools

Site Tools


blog:2024:0517_amprd_on_fedora_40

This is an old revision of the document!


44net: amprd IPIP on Fedora 40

The amprd package installs directly from the fedora repository. The configuration is straightforward, however getting firewalld and NetworkManager configured is a little tricky.

The amprd documentation refers to requiring the ipip_redirector for 4.13+ kernels. It's not required for the 6.8.9 kernel that comes with Fedora 40.

ampr.org requests

For starters, you'll need an ampr IP address and gateway. Visit the ampr portal and request an address. After you get an address, configure a gateway. Looking ahead, the first clue that you have the gateway correct is that you'll receive ripv2 packets when amprd is running. After pulling my hair out, I wasn't even sure my gateway was correct but upon misconfiguring it, the ripv2 packets stopped; so that was a good clue at least my gateway configuration was correct.

Note that changes in the portal can take a little while to take effect. For a gateway, I think an hour may be sufficient. But maybe it takes longer - since I was addressing several issues in the beginning, I'm not sure if maybe it took a day to take effect.

Your gateway configuration uses the IP address and hostname of the external IP address from which your Fedora machine is visible to ampr.org. The IP address does not need to reverse resolve. If you don't have a spare hostname, configure an ampr.org DNS entry to resolve to your external IP address. If the hostname and IP don't match the gateway IP entry updates to whatever the hostname resolves to - that's how you'll know you don't have your hostname resolving correctly.

NetworkManager

Amprd ended up creating a NetworkManager entry but it needed some tweaking. I'd suggest just creating the entry in advance and it will be all ready for the next step installing, configuring and starting amprd.

Create a new connection for your ampr0 interface that amprd will use. Create the file:

/etc/NetworkManager/system-connections/ampr0.nmconnection

and put in the following contents:

[connection]
id=ampr0
type=tun
interface-name=ampr0
zone=ampr

[tun]
mode=2

[ipv4]
address1=<your ip address>/32
method=manual

[ipv6]
method=disabled

[proxy]

Note that this expects a firewalld zone named ampr to exist. We'll create that below. Be sure to fill in your IP address. We use CIDR /32 because amprd is going to create the correct route for you. So basically we don't want any routes yet, just an IP address on the interface.

Be sure to set the file permissions correctly (compare to others in the folder). Then restart NetworkManager.

firewalld

We'll need to define a zone named ampr. This zone will masquerade. If you don't want this, leave out the masquerade declaration. On my server, it is my router handling internet traffic. When 44 traffic is routed out the IPIP interface, traffic will need to be masqueraded because all my local IP addresses are private, non-routable, e.g., 192.168.

This zone will be firewalled toward amprnet. In this example ssh, http and https are open inbound ports. Create the file:

/etc/firewalld/zones/ampr.xml

and put in the following contents:

<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>ampr-org</short>
  <description>For use toward ampr.org. You kind of trust the other computers on the networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="ssh"/>
  <service name="https"/>
  <service name="http"/>
  <masquerade/>
</zone>

Assuming you want to masquerade, we also need a policy for this new zone. Create the file:

/etc/firewalld/policies/NAT_to_ampr.xml

and put in the following contents:

<?xml version="1.0" encoding="utf-8"?>
<policy target="ACCEPT">
  <ingress-zone name="internal"/>
  <egress-zone name="ampr"/>
</policy>

where the ingress-zone should match the zone of your internal network. Ensure the file permissions are correct for these files.

Finally reload firewalld:

sudo firewall-cmd --reload

amprd

Install amprd with:

sudo dnf install amprd

Edit

/etc/amprd.conf

Define an ampr0 section. Enter your new 44 IP address into prefix with /8. That will enable all 44 traffic to be routed out the tunnel. If you want just a smaller subnet, use a narrower CIDR.

For now turn on multicast and rip. This will enable you to confirm you are connected to your gateway and receiving traffic. You can turn off the setting later if you like.

You don't need to set the rip_password. It hasn't changed in a long time and is compiled into the code. If you are interested in the password, I didn't find it with the -d option as the comment suggests (maybe I was running into other issues at the time) but I did see it using tcpdump.

Start up the amprd service and if you feel ready, enable it also to start on boot. To start it:

sudo systemctl start amprd

Try it out

A couple of tcpdumps will let you look at what's going on. On your external interface you can monitor the traffic going to the internet and the encapsulated IPIP traffic:

sudo tcpdump -nnvi eno2 host 169.228.34.84

169.228.34.84 is the amprnet gateway. The host directive will only show you traffic going to amprnet and not flood your console will all your other internet traffic.

You can also just examine the ampr0 tunneled traffic with:

tcpdump -nnvi ampr0

After a few minutes you should see ripv2 traffic coming from amprnet to a multicast address that includes your machine.

For whatever reason, the amprnet gateway takes around 60 minutes to start passing your traffic. You can start up a ping on a couple of different addresses that are pingable. Once you see replies your tunnel should be working. try 44.1.1.17 which is portal.ampr.org or 44.1.1.20 which is git.ampr.org.

Also, once the tunnel is working and assuming you want to use masquerade, see if a device on your internal network can browse to https://portal.ampr.org.

If your tunnel isn't working after an hour or so, study the tcpdump traffic for clues. If you suspect a firewall issue, try turning on logging (use sudo):

# check the zone is on the interface
firewall-cmd --get-zone-of-interface ampr0
# turn on logging
firewall-cmd --set-log-denied=all
firewall-cmd --get-log-denied
# examine the log and use ^C when done
journalctl -xef
# turn it off
firewall-cmd --set-log-denied=off
firewall-cmd --get-log-denied
Contact Us blog/2024/0517_amprd_on_fedora_40.1715994346.txt.gz · Last modified: (external edit)