Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-24-2004, 09:08 AM
|
#1
|
LQ Newbie
Registered: Jul 2004
Posts: 7
Rep:
|
Windows route configuration easier than Linux???
Hi Guys
I need to configure an ethernet interface, say 'eth0', and give it an IP of 10.1.1.19 with netmask 255.255.255.0
BUT
I need to set the default gw as 192.168.0.1
Whenever I do this with the 'route add default gw 192.168.0.1' command, it fails with:
SIOCADDRT: network is unreachable
I guess it only accepts default gateways that are similar, i.e. 10.1.1.X
In Windows this is straight forward; I just simply use the LAN properties window and play around with the TCP/IP properties to manually set the IP and gateway to whatever values I please and this works smoothly. Here's the output from windows:
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.0.1 10.1.1.19 20
10.1.0.0 255.255.0.0 10.1.1.19 10.1.1.19 20
10.1.1.19 255.255.255.255 127.0.0.1 127.0.0.1 20
10.255.255.255 255.255.255.255 10.1.1.19 10.1.1.19 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
224.0.0.0 240.0.0.0 10.1.1.19 10.1.1.19 20
255.255.255.255 255.255.255.255 10.1.1.19 10.1.1.19 1
Default Gateway: 192.168.0.1
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 10.1.1.19
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . : 192.168.0.1
There must be a trick to do so in Linux/Unix that i just can't figure out.
Hisham
|
|
|
08-24-2004, 09:11 AM
|
#2
|
Member
Registered: Oct 2003
Posts: 568
Rep:
|
Code:
route add 192.168.0.0 0.0.255.255 int eth0
|
|
|
08-24-2004, 04:32 PM
|
#3
|
LQ Newbie
Registered: Jul 2004
Posts: 7
Original Poster
Rep:
|
Thanks PenguinPwrdBox for the fast response.
Are you sure though of the exact syntax for that command. I tried running it but it failed, prompting me with the usage.
Furthermore, what does this command really do?
Hisham
|
|
|
08-24-2004, 05:17 PM
|
#4
|
Member
Registered: Jul 2004
Location: Netherlands
Distribution: fedora core 8, suse 10.3, ubuntu 7.10, kamikaze 7.09
Posts: 515
Rep:
|
What you want is impossible !
With eth0 having 10.1.1.19 you can only acces a 10.1.1. network,
What you can do with routing is program the routing table for a certain network
route add -net 192.168.0.0 netmask 255.255.255.0 gw 10.1.1.1 ( every address starting with 192.168.0 is send to router 10.1.1.1 )
route add default gw 10.1.1.254 the rest is send to 10.1.1.254
|
|
|
08-25-2004, 03:06 AM
|
#5
|
LQ Newbie
Registered: Jul 2004
Posts: 7
Original Poster
Rep:
|
I don't think this is gonna work. I need the default route to be sent to the gateway 192.168.0.1
I can't believe how straight forward this is in Windows. Here's the output of the route table from the DOS prompt. Isn't there a way to replicate this table's characteristics with a few 'route add' commands in Linux?
====================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.0.1 10.1.1.19 20
10.1.0.0 255.255.0.0 10.1.1.19 10.1.1.19 20
10.1.1.19 255.255.255.255 127.0.0.1 127.0.0.1 20
10.255.255.255 255.255.255.255 10.1.1.19 10.1.1.19 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
224.0.0.0 240.0.0.0 10.1.1.19 10.1.1.19 20
255.255.255.255 255.255.255.255 10.1.1.19 10.1.1.19 1
Default Gateway: 192.168.0.1
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 10.1.1.19
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . : 192.168.0.1
|
|
|
08-25-2004, 06:14 AM
|
#6
|
Member
Registered: Jul 2004
Location: Netherlands
Distribution: fedora core 8, suse 10.3, ubuntu 7.10, kamikaze 7.09
Posts: 515
Rep:
|
I have to tel you first that this a work around, you can do the following
first add an alias
ifconfig eth0:1 192.168.0.254
route add default gw 169.254.0.1
|
|
|
All times are GMT -5. The time now is 12:57 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|