LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Windows route configuration easier than Linux??? (http://www.linuxquestions.org/questions/linux-networking-3/windows-route-configuration-easier-than-linux-221725/)

hdalle 08-24-2004 09:08 AM

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

PenguinPwrdBox 08-24-2004 09:11 AM

Code:

route add 192.168.0.0 0.0.255.255 int eth0

hdalle 08-24-2004 04:32 PM

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

arno 08-24-2004 05:17 PM

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

hdalle 08-25-2004 03:06 AM

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

arno 08-25-2004 06:14 AM

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 08:44 PM.