LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-01-2016, 02:53 AM   #1
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 10, ubuntu 20.04, centos 7 & 8
Posts: 64

Rep: Reputation: Disabled
Wifi to eth, no nat


hi. i have a PC running debian 8 and it has a wlan0 and eth0. the wlan0 connects to a community wifi an gets an IP from dhcp. on eth0 is the switch that has all the PCs attached to it. i would like to have all the PCs to get an IP from the dhcp server of the wifi router and no NAT to be involved. So i will have internet directly from the community wifi, without NAT.
the setup is:
/etc/network/interfaces:
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "CommunityWiFi"
wpa-psk "xyzPaSswD"

auto eth0
iface eth0 inet dhcp



could someone help me please?
 
Old 10-01-2016, 07:15 PM   #2
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 417

Rep: Reputation: 74
So you want to use your wifi (which is connected to community wifi) as gateway for your LAN devices. Hmm, that's borderline quite sneaky. That's certainly doable. Enable IP forwarding, use your eth0 as gateway/NAT for your local devices and out on wlan0.

If you really want to use wlan0 without NAT, you can probably set up into bridge mode a la tunnel interface. Though I haven't done such kind of setup. I pretty much stick to TOS.
 
Old 10-02-2016, 08:27 AM   #3
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 10, ubuntu 20.04, centos 7 & 8
Posts: 64

Original Poster
Rep: Reputation: Disabled
Any ideas on how to do it? I need it to be on the same IP range as the community wifi, since i need to access some services they do offer and i do have in my PCs.

Last edited by atux_null; 10-02-2016 at 12:24 PM.
 
Old 10-03-2016, 10:06 AM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
As I understand it, you would need to modify the community wifi's settings, because by default wifi routers do not allow bridging as a security measure (in contrast, wired ethernet allows bridging).

Of course, if you don't need bridging, the easiest way to accomplish what you want is to comment out the "eth0" lines from your /etc/network/interfaces and use the network manager GUI to "Shared with Other Computers" in IPv4 settings. This does NAT and routing, with a local LAN on 10.42.0.x. I know you said this isn't what you want, but it is easy and will work. The computers connected to the shared connection can still access any services on any computers in the community wifi LAN simply by using those IP addresses (so long as those IP addresses are NOT in the 10.42.0.X range).
 
Old 10-03-2016, 12:06 PM   #5
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 10, ubuntu 20.04, centos 7 & 8
Posts: 64

Original Poster
Rep: Reputation: Disabled
i am afraid the gui is not an option due to hardware restrictions. the system is not capable of gui.
can i do the sharing with the cli?
What i really need to do is that http://askubuntu.com/questions/35985...rough-ethernet, but on cli. the machine cannot run gui, this is a requirement to be on cli only.

Last edited by atux_null; 10-03-2016 at 12:23 PM.
 
Old 10-03-2016, 12:31 PM   #6
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Search net for "Linux bridge".
 
Old 10-03-2016, 12:36 PM   #7
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 10, ubuntu 20.04, centos 7 & 8
Posts: 64

Original Poster
Rep: Reputation: Disabled
linux bridge is what i am using right now, but it uses nat. i would like to get rid of nat and simply use the same subnet. any guides, hints?
 
Old 10-03-2016, 12:39 PM   #8
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
https://wiki.linuxfoundation.org/networking/bridge

^^ First hit in Duckduckgo.
 
Old 10-03-2016, 02:15 PM   #9
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Bridging works great for wired<->wired. But not so much, with WiFi<->wired. The WiFi protocol has features to prevent spoofing which incidentally prevent packet forwarding (without NAT).

Anyway, I'm not sure whether there is a non-GUI front end for network-manager. If there is no non-GUI front end for network-manager, then the easiest solution may be to go through the effort of setting up NAT routing with iptables.
 
Old 10-04-2016, 12:31 PM   #10
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 10, ubuntu 20.04, centos 7 & 8
Posts: 64

Original Poster
Rep: Reputation: Disabled
I replaced temporarily the PC with my laptop (dual boot win7 pro, Ubuntu mate 16.04). While in win7 I can bridge the wireless interface to the wired (wlan0 -> eth0). It worked the way I wanted, without nat. Then I rebooted to Ubuntu and did it under the guidance to share the internet connection from wlan0 to eth0, without nat. It worked. I am trying to find out the config files where is that setting so I could copy it to my non GUI PC.
The whole process for windows and GUI is best described in http://blog.extramaster.net/2014/11/...-with.html?m=1
The part before nat.

If someone has any ideas I am here to listen.
 
Old 10-04-2016, 02:08 PM   #11
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by atux_null View Post
I replaced temporarily the PC with my laptop (dual boot win7 pro, Ubuntu mate 16.04). While in win7 I can bridge the wireless interface to the wired (wlan0 -> eth0). It worked the way I wanted, without nat. Then I rebooted to Ubuntu and did it under the guidance to share the internet connection from wlan0 to eth0, without nat. It worked. I am trying to find out the config files where is that setting so I could copy it to my non GUI PC.
The whole process for windows and GUI is best described in http://blog.extramaster.net/2014/11/...-with.html?m=1
The part before nat.

If someone has any ideas I am here to listen.
You actually have, in fact, done routing with NAT. Not bridging. The "Shared to other computers" in the Ubuntu GUI does full blown routing with NAT, with the eth0 interface using 10.42.0.1/255.255.255.0. It just makes it really easy to set up-just like the similar option in Windows.

But like I said earlier, I don't think there's a non-GUI front end for network-manager. If you want to set it up using strictly a text console interface, you'll have to go through the trouble of setting up things with iptables and such.

There is at least one inaccurate thing on that web page, though - the device which is connected to the laptop actually has full access to every other computer the laptop can access on the LAN - not just the internet.

Last edited by IsaacKuo; 10-04-2016 at 02:16 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Debian doesn't find wifi/eth drivers but Ubuntu 11.04/10 does? Jivan Naveen Linux - Newbie 6 01-19-2012 02:21 PM
Slackware 13 wifi config, and now both eth and wifi are down nenpa8lo Slackware 2 04-18-2010 07:18 PM
setting wifi and eth in slackware indriaj Linux - Newbie 3 08-05-2008 03:38 PM
wifi + nat + iptables barbobot Linux - Wireless Networking 2 01-25-2005 12:55 PM
Help IP Masquerading (wifi to eth) OEP Linux - Wireless Networking 17 08-11-2004 12:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:06 PM.

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