LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 09-22-2013, 07:31 AM   #1
ranmanh
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Rep: Reputation: 0
IP routing -- interface aliases.. access to the internet?


Hi

Apologies for the simplistic of the question but I am starting to really struggle with this.

I am trying to generate some IPs in my development boxes so I can use them as I source to send packages to the outside world.
i.e.
Code:
  
nc -s <src_ip> website port
GET / HTTP/1.1. Host: website
The purpose of this is testing some applications and routings related to proxies and web based applications.

So... What I have initially thought about was, given I got just 1 physical interface, create an alias with any IP and to work from there..
so..
Given an eth0, IP: 192.168.10.20 . GW : 192.168.10.1
alias: eth0:0 IP: 10.20.30.1
The alias works all right, and while I can recall local services from that IP I CANNOT route the traffic to GW: 192.168.10.1
I have played long with the routing tables but I cannot manage.

I have also tried to add new addresses to that device (At the present I do not need the change permanent)..
ip addr add 10.20.20.2 dev eth0

The same about the routing.... and while the device is present I still cannot manage to use that source IP to route traffic out of the box
on both scenarios I am the experiment seems 50:50 working..I can see the packages leaving the box:

Code:
  
  10.20.20.2.41167 > lhr14s20-in-f18.1e100.net.80: Flags [S], cksum 0x3159 (correct), seq 521265741, win 14600, options [mss 1460,sackOK,TS val 1658046 ecr 0,nop,wscale 6], length 0
But it seems the remote server cannot resolve, it cannot return the packages as it does not know what to do ...(at least that is my understanding of what is happening)

So it will not even start initiating the connection.

Any tip so I can move this forward please?

Just to say, I am reading documentation for days but at the present I got stranded on this as I have some gaps in the knowledge so I cannot completely tie all the bits together which is pretty frustrating.

Thanks very much.

Last edited by ranmanh; 09-22-2013 at 08:38 AM.
 
Old 09-22-2013, 10:53 AM   #2
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
You say "The purpose of this is testing some applications and routings related to proxies and web based applications."

Can you be more specific, like what you want to accomplish as your end goal? Or is just doing some vague testing your end goal (like for learning)?

If you have a web server that will use more than one IP address, all you need to do is have those IP addresses configured on that host, and have any connected host doing the routing with all those IPs as the route destination targeting that web server.

I think maybe you are overdoing something here. But first, I'd like to see a list of what machines you are working on, their network topology among them (for example are they on the same LAN or connected by a link or further apart) and what external connections these machines have. Which link or LAN or router is you path to the internet?

To think about this, I must have a picture in my mind of how your network is wired up (and possibly how that can be changed around if need be). I do not yet have such a picture of your network.
 
Old 09-22-2013, 11:04 AM   #3
ranmanh
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Skaperen View Post
You say "The purpose of this is testing some applications and routings related to proxies and web based applications."

.
going simple, I have simply run the following experiment badly explain above:

I got the following:
Code:
eth0      Link encap:Ethernet  HWaddr 00:1C:42:95:FD:94  
          inet addr:192.168.0.11  Bcast:192.168.0.255  Mask:255.255.255.0
route
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
Now I am adding a new address to eth0

Code:
ip addr add 10.20.20.2 dev eth0
And entry on the routing table:


Code:
 route add -host 10.20.20.2 dev eth0
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.20.20.2      *               255.255.255.255 UH    0      0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
Now I try:
Code:
nc -v -s 10.20.20.2 www.google.com 80 (and nothing happens)
while when using the default address for eth0 -192.168.0.11-:

Code:
nc -v -s 192.168.0.11 www.google.com 80
Connection to www.google.com 80 port [tcp/http] succeeded!
I am failing on something very fundamental in here and possibly some tips can help me to move forward on doing a proper learning?
I realise both ips are in a different class and range but I wonder what would be possible to do on this particular situation (if possible?


thanks very much

Last edited by ranmanh; 09-22-2013 at 02:41 PM. Reason: Example changed
 
Old 09-23-2013, 06:26 AM   #4
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
Code:
nc -v -s 10.20.20.2 www.google.com 80 (and nothing happens)
The above is outside you local subnet ie your router doesn't know about it.

Do you get the same problem if you use an ip within your local subnet ie 192.168.0.50?
 
Old 09-23-2013, 10:07 AM   #5
ranmanh
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by wildwizard View Post
[CODE]

The above is outside you local subnet ie your router doesn't know about it.

Do you get the same problem if you use an ip within your local subnet ie 192.168.0.50?
thanks very much for your reply wildwizard.
Within the same subnet, everything is fine, so i.e. 192.168.0.50 it works correctly... So I wonder how is possible to do something like that with an IP out of my defined net? Any tip about that?

Many thanks for your help.
 
  


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
Network trouble when routing eth1 aliases through eth0 sureshr23 Linux - Networking 2 04-27-2013 01:13 PM
Problem with VPN routing for Transmission Web Interface access SadE54 Linux - Networking 0 10-26-2010 09:46 AM
Multiple Internet Access Interface Managment:Debian Based Geneset Linux - Networking 0 09-26-2007 09:29 AM
Problem assigning multiple aliases to one interface xxloaf Linux - Networking 3 05-08-2007 07:28 PM
Shorewall Routing Internet access issues Raidmax Linux - Newbie 0 11-15-2005 07:29 PM

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

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