{"id":260,"date":"2026-11-10T15:30:00","date_gmt":"2026-11-10T10:00:00","guid":{"rendered":"https:\/\/proxykite.com\/blog\/?p=260"},"modified":"2026-11-10T15:30:00","modified_gmt":"2026-11-10T10:00:00","slug":"linux-policy-routing-multiple-4g-modems","status":"publish","type":"post","link":"https:\/\/proxykite.com\/blog\/linux-policy-routing-multiple-4g-modems\/","title":{"rendered":"Policy Routing Multiple Interfaces Linux for 4G Modems"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Policy routing multiple interfaces Linux is the pattern that keeps several 4G modems from competing to be one machine&#8217;s default gateway. This guide builds one routing table per modem, selects a path by source address or firewall mark, makes the rules persistent, and tests each mobile exit.<\/p>\n\n\n\n<aside class=\"ap-card\" aria-label=\"ProxyKite per-dongle licence\">\n<span class=\"ap-card__badge\">One licence per dongle<\/span>\n<div class=\"ap-card__body\"><p class=\"ap-card__name\">ProxyKite per-dongle licence<\/p><p class=\"ap-card__best\">Best for anyone turning their own 4G\/LTE dongles + SIMs into HTTP\/SOCKS5 mobile proxies, from 1 dongle to hundreds<\/p><ul class=\"ap-card__features\"><li>Every dongle becomes an HTTP + SOCKS5 proxy on a public port of our cloud router \u2014 no static IP or port forwarding, works behind CGNAT<\/li><li>IP rotation on demand, by rotation link, or on a timer from 60 s to 7 days (sticky option); returns old + new IP<\/li><li>One-line installer on a Raspberry Pi \/ Linux box; Huawei E3372 HiLink is the reference stick<\/li><li>SIM inbox for carrier messages, bandwidth limits per day\/week\/month, live traffic insights<\/li><li>Sub-users, white-label (your logo\/colours), REST API, webhooks and Telegram alerts included<\/li><li>Flat price, traffic is free \u2014 rides on your own SIM data plans<\/li><\/ul><\/div>\n<div class=\"ap-card__side\"><p class=\"ap-card__price\">$9 per dongle <small>per month<\/small><\/p><a class=\"ap-card__btn\" href=\"https:\/\/proxykite.com\/#pricing\">Talk to us \u2192<\/a><\/div>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">What you need<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This example assumes a Linux box with two or more Huawei E3372 HiLink dongles, or similar HiLink hardware, connected over USB. Each modem should already be online and have an IPv4 address, gateway, and interface name. A powered USB hub is important once several dongles share the box; the <a href=\"https:\/\/proxykite.com\/blog\/4g-proxy-farm-setup\/\">4G proxy farm setup guide<\/a> covers the hardware side.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You also need root access, the <code>ip<\/code> command from iproute2, <code>curl<\/code>, and one network manager. The commands below use <code>usb0<\/code> and <code>usb1<\/code> as examples. Your system may name them <code>eth1<\/code>, <code>enx...<\/code>, or something else, so discover the real names first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do not add every modem&#8217;s default route to the main table and hope that route metrics will provide separate proxies. Metrics choose a preferred route for the host; they do not associate each proxy process with a different mobile connection.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why multiple modems fight over the default route<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Normal Linux routing looks up a destination in the main routing table. If DHCP adds a default route for every dongle, the result is either one preferred default, an equal-cost choice, or a table that changes as interfaces appear and disappear. None of those outcomes means \u201cproxy A always uses modem A\u201d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Policy routing adds a routing policy database (RPDB) in front of the normal lookup. The kernel checks rules in increasing priority number, then looks up the selected table. The <a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/ip-rule.8.html\" target=\"_blank\" rel=\"noopener\">ip-rule manual page<\/a> documents source, incoming-interface, firewall-mark, and other selectors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For this use case, the clean model is:<\/p>\n\n\n\n<figure class=\"wp-block-table ap-table\"><table><thead><tr><th>Traffic selector<\/th><th>Rule<\/th><th>Table<\/th><th>Egress<\/th><\/tr><\/thead><tbody><tr><td>Source <code>192.168.8.100<\/code><\/td><td><code>from 192.168.8.100\/32<\/code><\/td><td><code>101<\/code><\/td><td><code>usb0<\/code><\/td><\/tr><tr><td>Source <code>192.168.9.100<\/code><\/td><td><code>from 192.168.9.100\/32<\/code><\/td><td><code>102<\/code><\/td><td><code>usb1<\/code><\/td><\/tr><tr><td>Mark <code>0x65<\/code><\/td><td><code>fwmark 0x65<\/code><\/td><td><code>101<\/code><\/td><td><code>usb0<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Each custom table contains a connected route and a default route through its own modem. The main table can remain the management path for SSH and other traffic that you have not explicitly assigned.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Inventory every modem<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: policy rules are only useful when they match the actual source address and interface that the modem received.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">List links, IPv4 addresses, and routes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ip -br link\nip -4 addr\nip -4 route<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For each modem, record the interface, address with prefix, connected network, and gateway. Inspect a single link with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ip -4 addr show dev usb0\nip -4 route show dev usb0\nip route get 1.1.1.1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A typical result might show an address such as <code>192.168.8.100\/24<\/code>, a connected route such as <code>192.168.8.0\/24<\/code>, and a gateway such as <code>192.168.8.1<\/code>. Use the values your modem actually reports. Repeat for <code>usb1<\/code> and every additional link.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If all HiLink dongles report the same LAN, such as <code>192.168.8.0\/24<\/code>, pause here. Two interfaces with the same gateway and the same source address cannot be separated reliably by a simple source rule. Either configure distinct modem-side LANs, or use the firewall-mark approach in Step 4, a network namespace per modem, or another isolation design.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/proxykite.com\/blog\/wp-content\/uploads\/2026\/10\/linux-policy-routing-multiple-4g-modems-1.webp\" alt=\"ProxyKite\u2019s Linux-box getting-started documentation\"\/><figcaption class=\"wp-element-caption\">ProxyKite\u2019s Linux-box getting-started documentation<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Create named routing tables<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: separate tables keep each modem&#8217;s connected route and default gateway together instead of mixing them in <code>main<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reserve a table number for each modem. The names are optional, but they make <code>ip route show table modem1<\/code> easier to read:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tee -a \/etc\/iproute2\/rt_tables &gt;\/dev\/null &lt;&lt;'EOF'\n101 modem1\n102 modem2\nEOF<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check for existing entries before choosing numbers. Do not reuse a table ID already owned by a VPN, container runtime, or another routing service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grep -E '(^|[[:space:]])(101|102)[[:space:]]' \/etc\/iproute2\/rt_tables\nip rule show<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like two free IDs that you can use consistently in routes, rules, and your network-manager configuration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Add source-based routing per modem<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: a proxy process can bind to a particular local address; the source rule then sends that connection through the matching modem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Set variables from Step 1. These values are examples for two modems with different local subnets:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MODEM1_IF=usb0\nMODEM1_IP=192.168.8.100\nMODEM1_NET=192.168.8.0\/24\nMODEM1_GW=192.168.8.1\nMODEM1_TABLE=101\nMODEM1_PRIORITY=101\n\nMODEM2_IF=usb1\nMODEM2_IP=192.168.9.100\nMODEM2_NET=192.168.9.0\/24\nMODEM2_GW=192.168.9.1\nMODEM2_TABLE=102\nMODEM2_PRIORITY=102<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install the link route and default route in each custom table. <code>src<\/code> gives Linux a preferred local address when the application has not selected one itself:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ip route replace table \"$MODEM1_TABLE\" \"$MODEM1_NET\" dev \"$MODEM1_IF\" src \"$MODEM1_IP\"\nsudo ip route replace table \"$MODEM1_TABLE\" default via \"$MODEM1_GW\" dev \"$MODEM1_IF\"\n\nsudo ip route replace table \"$MODEM2_TABLE\" \"$MODEM2_NET\" dev \"$MODEM2_IF\" src \"$MODEM2_IP\"\nsudo ip route replace table \"$MODEM2_TABLE\" default via \"$MODEM2_GW\" dev \"$MODEM2_IF\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add one rule for each source. The delete commands make the block safe to rerun after you change an address:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ip rule del priority \"$MODEM1_PRIORITY\" from \"$MODEM1_IP\/32\" table \"$MODEM1_TABLE\" 2&gt;\/dev\/null || true\nsudo ip rule add priority \"$MODEM1_PRIORITY\" from \"$MODEM1_IP\/32\" table \"$MODEM1_TABLE\"\n\nsudo ip rule del priority \"$MODEM2_PRIORITY\" from \"$MODEM2_IP\/32\" table \"$MODEM2_TABLE\" 2&gt;\/dev\/null || true\nsudo ip rule add priority \"$MODEM2_PRIORITY\" from \"$MODEM2_IP\/32\" table \"$MODEM2_TABLE\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The priority numbers are lower than the normal <code>main<\/code> rule, normally <code>32766<\/code>, so the modem-specific rules are considered first. Verify the result:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ip route show table modem1\nip route show table modem2\nip rule show\nip route get 1.1.1.1 from \"$MODEM1_IP\"\nip route get 1.1.1.1 from \"$MODEM2_IP\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The two <code>ip route get<\/code> results should name different devices and gateways. The <a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/ip-route.8.html\" target=\"_blank\" rel=\"noopener\">ip-route manual page<\/a> documents <code>route get<\/code>, table selection, source selection, and the <code>default<\/code> route syntax.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Use a firewall mark when source rules are not enough<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: a mark can select a table even when several modems use overlapping HiLink address ranges or the application cannot bind to a distinct source address.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a mark-to-table rule for modem 1, then repeat with a different mark and table for modem 2:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ip rule del priority 110 fwmark 0x65\/0xff table 101 2&gt;\/dev\/null || true\nsudo ip rule add priority 110 fwmark 0x65\/0xff table 101<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For locally generated traffic, one practical pattern is to run the proxy worker under a dedicated Unix user and mark that user&#8217;s output packets. This example uses UID <code>1001<\/code>; replace it with the real service UID:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nft add table inet pbr\nsudo nft 'add chain inet pbr output { type route hook output priority mangle; policy accept; }'\nsudo nft 'add rule inet pbr output meta skuid 1001 meta mark set 0x65'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The mark must be set before the route lookup. If you already have an <code>inet<\/code> mangle table, add the rule to its existing output chain instead of creating duplicate tables. To use the second modem, give its traffic a different selector, set mark <code>0x66<\/code>, and add <code>ip rule ... fwmark 0x66\/0xff table 102<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use marks deliberately. A rule that marks every output packet will also move SSH, DNS, package updates, and monitoring to one SIM. Source binding is easier to audit when your proxy software supports it; marks are more flexible for forwarded traffic and service-level separation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Make the rules survive reboots<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: <code>ip route<\/code> and <code>ip rule<\/code> changes made at a shell prompt live in the kernel until the interface or machine is restarted.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If NetworkManager owns the modem connections, put the table and rule in each connection profile. First list the profile names:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nmcli -f NAME,DEVICE,TYPE connection show<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then apply the settings to the matching profiles. NetworkManager&#8217;s <code>ipv4.route-table<\/code> places the connection&#8217;s IPv4 routes in that table, while <code>ipv4.routing-rules<\/code> adds the RPDB selector. Its <a href=\"https:\/\/www.networkmanager.dev\/docs\/api\/latest\/settings-ipv4.html\" target=\"_blank\" rel=\"noopener\">IPv4 reference<\/a> documents both properties.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nmcli connection modify \"Modem 1\" \\\n  ipv4.route-table 101 \\\n  ipv4.never-default no \\\n  ipv4.routing-rules \"priority 101 from 192.168.8.100\/32 table 101\"\n\nsudo nmcli connection modify \"Modem 2\" \\\n  ipv4.route-table 102 \\\n  ipv4.never-default no \\\n  ipv4.routing-rules \"priority 102 from 192.168.9.100\/32 table 102\"\n\nsudo nmcli connection up \"Modem 1\"\nsudo nmcli connection up \"Modem 2\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If your modem address comes from DHCP and can change, do not leave a stale <code>\/32<\/code> rule behind. Use a NetworkManager dispatcher hook or your distribution&#8217;s network-up hook to read the current address and gateway, rebuild that table, and then install the matching rule. Use only one service to own these routes; mixing NetworkManager, systemd-networkd, and a custom boot script usually creates duplicate or disappearing entries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If systemd-networkd owns the links, express the same design in each <code>.network<\/code> file with a per-link DHCP route table and a <code>[RoutingPolicyRule]<\/code> section containing <code>From=<\/code>, <code>Table=<\/code>, and <code>Priority=<\/code>. The values must still match the address actually assigned to that modem. Reload the one network manager that owns the interfaces, then verify with <code>ip route show table 101<\/code> and <code>ip rule show<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify each exit IP<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: a route lookup proves the kernel&#8217;s decision; an external request proves the modem and mobile carrier actually carried the connection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Test each local source explicitly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -4 --interface \"$MODEM1_IP\" --max-time 20 https:\/\/api.ipify.org\necho\ncurl -4 --interface \"$MODEM2_IP\" --max-time 20 https:\/\/api.ipify.org\necho<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The responses should be public IPv4 addresses from the two mobile connections. They do not need to be permanent, and they may change when a carrier session is renewed. What matters is that two tests bound to two different local sources leave through the intended interfaces.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a proxy service, repeat the test through each listening port or endpoint. Confirm that the service is actually binding the worker socket to the intended modem address; a listener on <code>0.0.0.0<\/code> alone does not select an egress path. The <a href=\"https:\/\/proxykite.com\/docs\/guide\/proxy-formats\">ProxyKite proxy formats guide<\/a> is useful once you turn the working paths into HTTP or SOCKS5 endpoints.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Both tests return the same exit IP<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run <code>ip route get 1.1.1.1 from &lt;source-ip&gt;<\/code>. If both results show the same device, the rule priority, source address, or table is wrong. If the route lookup is correct but <code>curl<\/code> is not, the application is not binding to the source address, or the firewall mark is not being restored before output routing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>RTNETLINK answers: Network is unreachable<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The custom table probably has a default route but no connected route to the modem gateway. Add the modem&#8217;s actual connected prefix first, then the default route. Check <code>ip -4 route show dev &lt;interface&gt;<\/code> rather than assuming every HiLink device uses the same prefix.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">One modem works until another is plugged in<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Look for duplicate default routes in <code>main<\/code>, duplicate rules, or a network manager rewriting the table after DHCP renews. <code>ip monitor route<\/code> and <code>ip monitor rule<\/code> show changes while you reconnect a dongle. Move the routes into the manager that owns the interfaces and keep the management interface&#8217;s default route in <code>main<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Every dongle uses <code>192.168.8.0\/24<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">That is an overlapping-LAN problem, not a missing <code>ip rule<\/code> flag. A source <code>\/32<\/code> rule cannot distinguish two interfaces that present the same local address. Use distinct modem-side subnets where supported, or isolate each modem in a network namespace and connect the proxy workers to those namespaces; a mark-based design can also work when your traffic classification is reliable.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The modem route works but DNS does not<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Test an IP first with <code>curl --interface &lt;source-ip&gt; https:\/\/1.1.1.1\/<\/code>. If that works, inspect which resolver is being used and whether DNS queries are bound to the desired path. For a proxy product, prefer the proxy worker&#8217;s own resolver behavior and verify the public endpoint rather than changing the host&#8217;s global DNS setting blindly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Skip the manual routing: what ProxyKite handles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Manual policy routing is useful when you want to learn the kernel path or maintain a custom network design. It becomes operational work once every dongle needs a public HTTP and SOCKS5 endpoint, authentication, rotation, usage limits, SMS access, and a way to survive modem reconnects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ProxyKite&#8217;s Linux agent and cloud router are designed for customer-owned Huawei E3372 HiLink dongles on a Raspberry Pi or Linux box. The licence is <strong>$9 per dongle<\/strong> per month, with no per-GB charge; you provide the hardware and SIM data plan. The service does not require a static IP or inbound port forwarding, so the box can remain behind CGNAT.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can rotate on demand, with a rotation link, or on a timer from 60 seconds to 7 days, with a sticky option. Sub-users, white-label controls, REST API access, bandwidth limits, SMS inbox\/send, and live traffic insights are included in the per-dongle licence. See the <a href=\"https:\/\/proxykite.com\/blog\/raspberry-pi-mobile-proxy\/\">Raspberry Pi mobile proxy guide<\/a> for the hardware model and the <a href=\"https:\/\/proxykite.com\/docs\/guide\/getting-started\">ProxyKite getting-started documentation<\/a> for the installation path.<\/p>\n\n\n\n<aside class=\"ap-cta\" aria-label=\"Route your fleet faster\"><div class=\"ap-cta__content\"><p class=\"ap-cta__eyebrow\">Flat per-dongle pricing<\/p><p class=\"ap-cta__title\">Route your fleet faster<\/p><p class=\"ap-cta__text\">Turn your own HiLink dongles into managed HTTP and SOCKS5 endpoints.<\/p><\/div><a class=\"ap-cta__btn\" href=\"https:\/\/proxykite.com\/contact\">Talk to us<\/a><\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">What is policy routing in Linux?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Policy routing lets Linux choose a routing table from selectors such as source address or firewall mark, instead of using only the destination and main table. <code>ip rule<\/code> checks those selectors in priority order, then the selected table supplies the next hop and interface.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can I use multiple default gateways on one Linux host?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, but put each default route in its own table and select that table with an <code>ip rule<\/code>. Multiple defaults in the main table alone usually provide preference or load sharing, not a reliable per-modem path for separate proxy workers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Do I need a static public IP for each 4G modem?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. The policy route uses the modem&#8217;s local address and gateway on the Linux box; the mobile network supplies the public address. The public address can change when the cellular session changes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why do identical HiLink subnets break source-based routing?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Source rules match addresses, not the physical intention behind an address. If two interfaces both use the same local subnet and address, the kernel needs another selector, such as a firewall mark, namespace, or distinct modem-side subnet, to keep the paths separate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How can I expose each modem as a proxy endpoint?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Bind each proxy worker to the modem source address, or classify the worker&#8217;s traffic with a firewall mark and an <code>ip rule<\/code>. After the route lookup is correct, test the endpoint from outside the box and confirm each endpoint returns the expected mobile exit before adding rotation or customer traffic.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"What is policy routing in Linux?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Policy routing lets Linux choose a routing table from selectors such as source address or firewall mark, instead of using only the destination and main table. ip rule checks those selectors in priority order, then the selected table supplies the next hop and interface.\"}}, {\"@type\": \"Question\", \"name\": \"Can I use multiple default gateways on one Linux host?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Yes, but put each default route in its own table and select that table with an ip rule. Multiple defaults in the main table alone usually provide preference or load sharing, not a reliable per-modem path for separate proxy workers.\"}}, {\"@type\": \"Question\", \"name\": \"Do I need a static public IP for each 4G modem?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. The policy route uses the modem's local address and gateway on the Linux box; the mobile network supplies the public address. The public address can change when the cellular session changes.\"}}, {\"@type\": \"Question\", \"name\": \"Why do identical HiLink subnets break source-based routing?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Source rules match addresses, not the physical intention behind an address. If two interfaces both use the same local subnet and address, the kernel needs another selector, such as a firewall mark, namespace, or distinct modem-side subnet, to keep the paths separate.\"}}, {\"@type\": \"Question\", \"name\": \"How can I expose each modem as a proxy endpoint?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Bind each proxy worker to the modem source address, or classify the worker's traffic with a firewall mark and an ip rule. After the route lookup is correct, test the endpoint from outside the box and confirm each endpoint returns the expected mobile exit before adding rotation or customer traffic.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Learn policy routing multiple interfaces linux for 4G modems: build per-modem tables, source rules, fwmarks, persistence, and exit-IP tests.","protected":false},"author":1,"featured_media":261,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[1],"tags":[200,201,198,199,14],"class_list":["post-260","post","type-post","status-publish","format-standard","has-post-thumbnail","category-build-4g-proxy-farm","tag-4g-modems","tag-ip-rule","tag-linux-networking","tag-policy-routing","tag-raspberry-pi","cs-entry"],"_links":{"self":[{"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/posts\/260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/comments?post=260"}],"version-history":[{"count":1,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":495,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/posts\/260\/revisions\/495"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/media\/261"}],"wp:attachment":[{"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/media?parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/categories?post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/proxykite.com\/blog\/wp-json\/wp\/v2\/tags?post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}