LinuxQuestions.org
Review your favorite Linux distribution.
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 11-09-2014, 07:13 PM   #1
skamoll
LQ Newbie
 
Registered: Nov 2014
Posts: 3

Rep: Reputation: Disabled
Trouble with alias


Hello, good evening.

I'm having trouble setting up the following:

Router IP: 192.168.1.1

PC
Eth0 - 192.168.1.104
Eth0:1 - 10.0.0.1 (must be an alias)

Besides ip_forward enabled, what should I add to iptables rules, so that computers on the network 10.0.0.0 and 10.0.0.1 gateway, to access the internet?

I guess a POSTROUTING and a FORWARD and would be added, but I can not configure it.

thank you very much
 
Old 11-09-2014, 09:17 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,465
Blog Entries: 28

Rep: Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177
I'm not quite clear on what you are looking to do, but perhaps this will help:

http://www.cyberciti.biz/faq/linux-c...work-card-nic/

By the by, "alias" has a number of different meanings in Linux; the most common meaning is to "alias" one command to another in bash. See "apropos alias" for more.
 
Old 11-10-2014, 02:55 AM   #3
skamoll
LQ Newbie
 
Registered: Nov 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you very much, as shown in the website link, I am creating an alias for the nic, but aliases can't be used with iptables, and I can't set the rules to make ipforwarding between eth0 (physical) and eth0:1 (alias).

My intention is to mount two networks on the same wiring, (10.0.0.0) on eth0:1 and (192.168.1.0) on eth0, being the gateway router at 192.168.1.1, It makes no sense, but I can only use one NIC in the pc.
Attached Thumbnails
Click image for larger version

Name:	esquema_red_alias.jpg
Views:	10
Size:	15.1 KB
ID:	16842  

Last edited by skamoll; 11-10-2014 at 03:06 AM.
 
Old 11-10-2014, 08:19 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,465
Blog Entries: 28

Rep: Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177Reputation: 6177
It sounds as if you are trying to alias the nic so you can use the computer as a router that passes through traffic from the "real" IP address to and from the "aliased" IP address through a single wired connection.

I doubt that that can be done; I don't know of a way to fool one physical cable into thinking it's two. If I'm wrong, I would hope someone comes along and corrects me. http://cr.yp.to/djbdns/ifconfig.html

Perhaps you could get a USB network card to serve as the second card; if you want to try that, though, research cards first and pick one that you know works flawlessly with Linux.

Last edited by frankbell; 11-10-2014 at 08:20 PM.
 
Old 11-11-2014, 01:51 AM   #5
skamoll
LQ Newbie
 
Registered: Nov 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Exactly the right thing would be two nics but not possible.

I've gotten it to work using these commands. But I do not understand because it only works if the nic is in promiscuous mode. I discovered it by chance, only routes when I analyze the frames with wireshark. Then I realized that working in promiscuous mode.

Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE
iptables -A FORWARD -s 10.0.0.1 -d 192.168.1.104 -j ACCEPT
ifconfig eth0 promisc

Last edited by skamoll; 11-11-2014 at 01:55 AM.
 
  


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
bash script to display alias commands and un-alias any less than 12 characters bani Linux - Newbie 5 01-19-2014 12:34 PM
LXer: alias.sh puts your Linux shell alias on the clouds LXer Syndicated Linux News 0 01-21-2013 12:00 AM
Wildcard email alias in /etc/alias file custangro Linux - Enterprise 1 10-02-2009 12:17 PM
Trouble with alias IP on Debian 4 jakev383 Linux - Networking 10 01-21-2008 06:24 AM
trouble creating alias coldbeerz Linux - Newbie 4 11-19-2007 10:37 AM

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

All times are GMT -5. The time now is 10:54 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