Ethernet Ad-Hoc Networking Issues

The title is stupid, but I have the following:

  1. I have setup an Ad-Hoc network between 2 laptops, A and B.
  2. They can ping each other. (My Ethernet cards are not from the stone-age, no special cables required.)
  3. A has a static IP of, while B has a static IP of Submask is
  4. My real router uses 192.x.x.x. addresses, no conflicts there.
  5. If I disable Wi-Fi on Laptop B, it cannot browse the WWW. This is expected.

You may ask why I am doing this. The reason is simple: Laptop B’s Wi-Fi card sucks. 1 dot whereas A gets near-full strength (they’re next to each other). Oh, and so my Dad doesn’t accuse me of slowing down the internet when I start a netgame.

What I am trying to accomplish is allow B to use A’s Wi-Fi connection through Ethernet. I know I need to setup NAT on A to allow for this. To set up NAT, I would need to use iptables on A, or ebtables on B to route the data some how(That’s what StackOverflow says). The question is:

  1. Am I on the right track in the first place?
  2. If I am, how would I set up the rules? (Don’t spoon feed, please)

I love garlic.

1 Like

It seems like I didn’t SearX enough.

I found the Arch Wiki page linked on the SO page you linked more helpful.

Here’s what I did (Credit: Arch Wiki):

NOTE: All configuration is done on the server computer, except for the final step of Assigning IP addresses to the client PC(s).

NOTE: wlan0 is your server’s Wi-Fi card, while eno1 is the server’s ethernet.
NOTE: You can replace with anything that starts with 10. or 192.. Anything else will come back to bite.
NOTE: Your real router will see these 2 devices as 1, due to NAT.
NOTE: If no systems support MDI-X, you will need a crossover cable. (Gigabit Ethernet supporting systems will not need one for sure, for older standards just check with # ethtool interface | grep MDI)

  1. On the server machine (sharer) set your Ethernet like so:

    or use
# ip link set up dev net0
# ip addr add dev wlan0 # arbitrary address
  1. sudo nano /etc/sysctl.d/90-ethernet-share.conf with the following contents:
net.ipv4.ip_forward = 1
net.ipv4.conf.all.forwarding = 1
net.ipv6.conf.all.forwarding = 1
  1. Set up NAT. I will use the firewalld method.
# firewall-cmd --zone=external --change-interface=wlan0 --permanent
# firewall-cmd --zone=internal --change-interface=eno1--permanent

Then add a new policy to let traffic flow between the internal and external zone:

# firewall-cmd --permanent --new-policy int2ext
# firewall-cmd --permanent --policy int2ext --add-ingress-zone internal
# firewall-cmd --permanent --policy int2ext --add-egress-zone external
# firewall-cmd --permanent --policy int2ext --set-target ACCEPT
# firewall-cmd --reload
  1. Setting up DHCP:
    Check if dnsmasq is installed. If it’s not, install it.
    Back up your current dnsmasq configuration with # mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
    Create a new dnsmasq.conf with # nano /etc/dnsmasq.conf with the following contents (change as you need):
# make dnsmasq listen for requests only on eno1 (our LAN)

# optionally disable the DHCP functionality of dnsmasq and use systemd-networkd instead
#no-dhcp-interface=eno1 expand-hosts

# add a domain to simple hostnames in /etc/hosts
# allow fully qualified domain names for DHCP hosts (needed when "expand-hosts" is used)
# defines a DHCP-range for the LAN:
# from to .255 with a subnet mask of and a
# DHCP lease of 1 hour (change to your own preferences)

Now systemctl start dnsmasq and systemctl enable dnsmasq.
Reboot the server (for sysctl settings to apply)

  1. (DO THIS ON THE CLIENT! [receiver]):
# firewall-cmd --zone=internal --permanent --add-service dns
# firewall-cmd --zone=internal --permanent --add-service dhcp
# firewall-cmd --zone=internal --permanent --add-service dhcpv6

Reboot the client. (just in case)

I would recommend using the same DNS on both computers, but I don’t think it’s necessary.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.