LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-03-2021, 11:32 AM   #1
louloulou
LQ Newbie
 
Registered: May 2021
Posts: 2

Rep: Reputation: Disabled
access public network with laptop -> ethernet -> nxpBoard -> 5GModem -> public network


Hello,

I have a nxpBoard which has a 5GModem and an ethernet port. This nxpBoard can connect to the public network through the 5gModem.

I connect a laptop to the ethernet port of the nxpBoard and I would like to have access to the public network, on the laptop.
summary:
laptop -> ethernet -> nxpBoard -> 5GModem -> public network

The nxpboard has two interface eth0:192.168.1.1 and 5Gmoden (wwan:100.104.102.249)
The laptop has one interface (eth)enp5s0:192.168.1.2

the nxpobard can ping www.google.com and the laptop
the laptop can ping the nxpboard but cannot ping www.google.com

I don't understand what I'm missing. Bellow is my configuration.

Thank you,

On nxpboard
# ifconfig
Code:
eth0      Link encap:Ethernet  HWaddr 00:04:9F:06:EF:C6  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::204:9fff:fe06:efc6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:38 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3328 (3.2 KiB)  TX bytes:3124 (3.0 KiB)

wwan0     Link encap:Ethernet  HWaddr EE:11:9D:37:87:28  
          inet addr:100.104.102.249  Bcast:0.0.0.0  Mask:255.255.255.252
          inet6 addr: fe80::ec11:9dff:fe37:8728/64 Scope:Link
          UP BROADCAST RUNNING NOARP MULTICAST  MTU:1428  Metric:1
          RX packets:21 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1849 (1.8 KiB)  TX bytes:2982 (2.9 KiB)
# route
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         100.104.102.250 0.0.0.0         UG    0      0        0 wwan0
8.8.8.0         100.104.102.250 255.255.255.0   UG    0      0        0 wwan0
100.104.102.248 *               255.255.255.252 U     0      0        0 wwan0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
# iptables -L -v
Code:
Chain INPUT (policy ACCEPT 36 packets, 3180 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   11   756 ACCEPT     all  --  eth0   wwan0   anywhere             anywhere            
    1    60 ACCEPT     all  --  wwan0  eth0    anywhere             anywhere             state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT 42 packets, 3392 bytes)
 pkts bytes target     prot opt in     out     source               destination
On the Laptop

laptop-GE66:~$ ifconfig
Code:
enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::6261:6c92:3e99:20ae  prefixlen 64  scopeid 0x20<link>
        ether 2c:f0:5d:b5:a4:30  txqueuelen 1000  (Ethernet)
        RX packets 28  bytes 2264 (2.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 301  bytes 25115 (25.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xa1200000-a12fffff
laptop-GE66:~$ route -n
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    20100  0        0 enp5s0
10.45.0.0       0.0.0.0         255.255.0.0     U     0      0        0 ogstun
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 ogstun
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 enp5s0
 
Old 05-04-2021, 03:48 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
You're not NATing the laptop traffic, go read up about NAT / MASQUERADE
 
Old 05-04-2021, 11:12 AM   #3
louloulou
LQ Newbie
 
Registered: May 2021
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you, yes I needed to look MASQUERADE, it is working now but only for ip address not for domain name. Here is how I configured eth0 and wwan0 :

Code:
#!/bin/sh
ifconfig eth0 192.168.1.1
iptables -F
echo 1 > /proc/sys/net/ipv4/ip_forward
MODEM="wwan0"
ETH="eth0"
iptables -t nat -A POSTROUTING -o $MODEM -j MASQUERADE
iptables -t nat -A POSTROUTING -o $ETH -j MASQUERADE
iptables -A FORWARD -i $ETH -o $MODEM  -j ACCEPT
iptables -A FORWARD -i $MODEM -o $ETH -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -L -v
On the nxpboard I have a custom linux build with buildroot, I added dnsmasq to solve the domain name, I'm working on it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
access pvt. network from public network divyashree Linux - Networking 1 07-13-2009 10:51 PM
PCMCIA ethernet driver loaded --now what? How do I access ethernet? KWTm Linux - Hardware 3 07-10-2006 01:07 PM
Ethernet card on laptop: I installed my D-Link ethernet card into Redhat 9, not detec brighamr Linux - Hardware 0 05-18-2004 12:33 AM
laptop can access samba server via ethernet cable but not wireless? cmisip Linux - Wireless Networking 4 05-24-2003 01:25 AM
To anyone=(To go public or not to go public that is the question...) hotrodowner Linux - General 10 06-25-2002 09:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration