{"id":761,"date":"2013-08-05T15:12:21","date_gmt":"2013-08-05T13:12:21","guid":{"rendered":"https:\/\/marc.storck.lu\/blog\/?p=761"},"modified":"2013-12-14T10:47:26","modified_gmt":"2013-12-14T09:47:26","slug":"howto-setup-an-amprnet-gateway-on-linux","status":"publish","type":"post","link":"https:\/\/marc.storck.lu\/blog\/2013\/08\/howto-setup-an-amprnet-gateway-on-linux\/","title":{"rendered":"HowTo setup an AMPRnet Gateway on Linux"},"content":{"rendered":"<p>I had to setup many AMPRnet gateways on Linux machines and I always had a hard time remembering the different steps, so I try to provide a quick start over here.<\/p>\n<p>I have been using the RIP44d deamon for all my installations, so we&#8217;ll start with downloading the current version of RIP44d:<\/p>\n<blockquote><p>sudo wget -O \/usr\/local\/sbin\/rip44d\u00a0https:\/\/raw.github.com\/hessu\/rip44d\/master\/rip44d<\/p><\/blockquote>\n<p>The file needs to be executable by root<\/p>\n<blockquote><p>sudo chmod 744\u00a0\/usr\/local\/sbin\/rip44d<\/p><\/blockquote>\n<p><!--more-->Next we need is a starter script which does all the magic around RIP44d, the IPIP tunnel interface, enable ip forwarding in sysctl etc, etc. I usually create a file in \/usr\/local\/sbin called startampr with the following content<\/p>\n<blockquote><p>##################################################################<br \/>\n## This script was developed by KB3VWG on a standard Ubuntu 12.04.1 LTS PC<br \/>\n## with IPv4 forwarding enabled in \/etc\/sysctl.conf by changing the<br \/>\n## net.ipv4.ip_forward variable to 1, eth0 configured to the Public facing<br \/>\n## LAN and eth1 to the 44LAN. It is designed to enable an AMPR Router using the<br \/>\n## rip44d_table44 file, the standard rip44d, using the -t switch to add routes<br \/>\n## to routing table &#8217;44&#8217; with no fruther configuration needed (firewall optional)<br \/>\n##################################################################<br \/>\n## This script was modified by LX1DUC to automate even more tasks.<br \/>\n##################################################################<\/p>\n<p>########################################<br \/>\n### ENABLE IP FORWARDING ###<br \/>\nsysctl -w net.ipv4.ip_forward=1<\/p>\n<p>########################################<br \/>\n### ENABLE IPIP TUNNEL INTERFACE tunl0 ###<br \/>\n### you must enable the tunnel before specifying routes using the tunnel<br \/>\nmodprobe ipip<br \/>\nip addr add 44.256.0.1\/32 dev tunl0<br \/>\n### gives tunnel its own TTL of 64 enabling traceroute over tunnel<br \/>\nip tunnel change ttl 64 mode ipip tunl0<br \/>\nip link set dev tunl0 up<\/p>\n<p>########################################<br \/>\n### FIREWALL TO COMPLY WITH AMPR ROUTING RULES ###<br \/>\n### REGARDING TEST SUBNET ###<br \/>\niptables -A FORWARD -s 44.128.0.0\/16 -j REJECT<br \/>\niptables -A FORWARD -d 44.128.0.0\/16 -j REJECT<\/p>\n<p>########################################<br \/>\n### LAN ROUTING RULES (required if used as the LAN&#8217;s gateway) ###<br \/>\n### Allows 44LAN to use main routing table to access LAN (optional)<br \/>\n### (NAT\/masquerade from 44.60.44.0\/24 to must be configured<br \/>\n### if LAN hosts do not use AMPR Router as their LAN Gateway)<br \/>\n#ip rule add from 44.60.44.0\/24 to table main priority 1<\/p>\n<p>########################################<br \/>\n### AMPR ROUTING RULES ###<br \/>\n### Per PE1CHL: &#8216;This is &#8220;required&#8221; to get routing of the net-44 traffic correct ###<br \/>\n### and have a default route for the tunneled traffic different from the default ###<br \/>\n### route of the system. It may be possible to get it working without this, but ###<br \/>\n### policy based routing is so much easier.&#8217; ###<br \/>\n### Packets to and from the 44 Network use Route Table 44<br \/>\nip rule add to 44.0.0.0\/8 table 44 priority 44<br \/>\nip rule add from 44.256.0.0\/24 table 44 priority 45<\/p>\n<p>########################################<br \/>\n### TABLE 44 ROUTES ###<br \/>\n### Default Route [Internet Access] using AMPRGW for 44\/8 hosts (optional)<br \/>\n### do NOT change the IP 169.228.66.251, this is the central AMPR Gateway<br \/>\n### and all traffic leaving AMPRnet towards the internet MUST pass this router.<br \/>\nip route add default dev tunl0 via 169.228.66.251 onlink table 44<br \/>\n### Leave the 44.0.0.1 route below commented if the default route is used,<br \/>\n### in which case, RIP44 will create it automatically<br \/>\n### ip route add 44.0.0.1 dev tunl0 via 169.228.66.251 onlink table 44 window 840<br \/>\n### Adds 44LAN Network to Table 44<br \/>\nip route add 44.256.0.0\/24 dev eth1 table 44<br \/>\n########################################<\/p>\n<p>### STARTS THE rip44d ROUTER DAMEON &#8211; removing the WAN IP address of the local gateway ###<br \/>\n### (rip44d announcements, 44LAN route, and removing local WAN IP with -a switch<br \/>\n### equals full AMPR routing table)<br \/>\n\/usr\/local\/sbin\/rip44d -a 192.0.2.1 -p pAsSwOrDgOeShErE -t 44 &lt; \/dev\/null &amp;<\/p><\/blockquote>\n<p>Many thanks to KB3VWG and PE1CHL.<\/p>\n<p>The file must also be executable by root<\/p>\n<blockquote><p>sudo chmod 744 \/usr\/local\/sbin\/startampr<\/p><\/blockquote>\n<p><span style=\"color: #ff0000;\"><strong>IMPORTANT<\/strong><\/span>, please replace the invalid IP address network 44.256.0.0\/24, the invalid IP address 44.256.0.1 and the documentation IP 192.0.2.1 according to your local setup:<\/p>\n<ul>\n<li>44.256.0.0\/24 must be replaced with your network and netmask (your netmask may differ from \/24!!!)<\/li>\n<li>44.256.0.1 should be replaced by the IP address assigned to the gateway on your AMPRnet LAN<\/li>\n<li>192.0.2.1 should be replaced by your public static IP address<\/li>\n<\/ul>\n<p>Next you can run execute<\/p>\n<blockquote><p>sudo startampr &amp;<\/p><\/blockquote>\n<p><span style=\"color: #3366ff;\"><strong>TODO<\/strong><\/span>:<\/p>\n<ul>\n<li>setup iptables to limit access to the system<\/li>\n<li>setup AMPRnet gatway behind NAT (hoepfully there will be another solution for this soon)<\/li>\n<li>detect external public IP address automatically<\/li>\n<\/ul>\n<p><span style=\"color: #339966;\"><strong>UPDATES<\/strong><\/span>:<\/p>\n<ul>\n<li>make startampr script executable<\/li>\n<li>show how to launch startampr<\/li>\n<li>explain the IP address 169.228.66.251<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I had to setup many AMPRnet gateways on Linux machines and I always had a hard time remembering the different steps, so I try to provide a quick start over here. I have been using the RIP44d deamon for all my installations, so we&#8217;ll start with downloading the current version of RIP44d: sudo wget -O &hellip; <a href=\"https:\/\/marc.storck.lu\/blog\/2013\/08\/howto-setup-an-amprnet-gateway-on-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;HowTo setup an AMPRnet Gateway on Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,52],"tags":[58,59,9],"class_list":["post-761","post","type-post","status-publish","format-standard","hentry","category-hobbies","category-interests","tag-amprnet","tag-ham-radio","tag-linux"],"_links":{"self":[{"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/posts\/761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/comments?post=761"}],"version-history":[{"count":11,"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/posts\/761\/revisions"}],"predecessor-version":[{"id":800,"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/posts\/761\/revisions\/800"}],"wp:attachment":[{"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/media?parent=761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/categories?post=761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/marc.storck.lu\/blog\/wp-json\/wp\/v2\/tags?post=761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}