Networking Forums

Networking Forums > Computer Networking > Linux Networking > How to access hosts in other subnet

Reply
Thread Tools Display Modes

How to access hosts in other subnet

 
 
lovecreatesbea...@gmail.com
Guest
Posts: n/a

 
      07-29-2008, 02:05 AM
My Linux machine is assigned the following network setting:

address 192.168.3.101
gateway 192.168.3.101
netmask 255.255.255.0

But I need to access hosts reside in other subnetworks

address 192.168.4.10
address 192.168.5.11
address 192.168.10.12

(address 192.168.x.x etc.)

Before I assigned more IP adresses for my machine to access those
hosts. Can I use a proper netmask with only single IP address to do
so?
 
Reply With Quote
 
 
 
 
lovecreatesbea...@gmail.com
Guest
Posts: n/a

 
      07-29-2008, 02:08 AM
On Jul 29, 10:05*am, "lovecreatesbea...@gmail.com"
<lovecreatesbea...@gmail.com> wrote:
> My Linux machine is assigned the following network setting:
>
> * * * * address 192.168.3.101
> * * * * gateway 192.168.3.101


sorry, it is:
gateway 192.168.3.1


> * * * * netmask 255.255.255.0

 
Reply With Quote
 
Ronald Nissley
Guest
Posts: n/a

 
      07-29-2008, 04:26 AM
On Mon, 28 Jul 2008 19:05:53 -0700, lovecreatesbea...@gmail.com wrote:

> Before I assigned more IP adresses for my machine to access those hosts.
> Can I use a proper netmask with only single IP address to do so?


There is no "magical" netmask that will allow you to connect to these
other subnets. You need routes to get to these networks. For example, if
another system with IP address 192.168.3.5 has a second interface with
the address 192.168.4.1 assigned (and routes between the two networks),
then you would do something like:

# route add -net 192.168.4.0 netmask 255.255.255.0 gw 192.168.3.5

to be able to talk to systems on the 192.168.4.0/24 network.

If you run a DHCP server (not the simple DHCP server option on a home-
class router) on your network, check if it handles a classless static
route option (scope option 249 on Microsoft's DHCP server). This option
can ease administration by letting DHCP configure client routing tables.
From my brief research on this, it's not clear, but I think only some
Microsoft DHCP clients (XP, Windows 2003) support this option. ISC's DHCP
Client doesn't appear to support this option, however, ISC's DHCP Server
can support this option. You would need to define it.

http://lists.freebsd.org/pipermail/f...uestions/2005-
December/107071.html

You can also try to have routes automatically added when interfaces are
brought "up".

http://listas.softwarelibre.cu/piper...ly/038063.html

-Ciao

Ron
 
Reply With Quote
 
lovecreatesbea...@gmail.com
Guest
Posts: n/a

 
      07-29-2008, 05:40 AM
On Jul 29, 12:26*pm, Ronald Nissley <rnissley+use...@gmail.com> wrote:
> On Mon, 28 Jul 2008 19:05:53 -0700, lovecreatesbea...@gmail.com wrote:
> > Before I assigned more IP adresses for my machine to access those hosts..
> > Can I use a proper netmask with only single IP address to do so?

>
> There is no "magical" netmask that will allow you to connect to these
> other subnets. You need routes to get to these networks. For example, if
> another system with IP address 192.168.3.5 has a second interface with
> the address 192.168.4.1 assigned (and routes between the two networks),
> then you would do something like:
>
> # route add -net 192.168.4.0 netmask 255.255.255.0 gw 192.168.3.5
>
> to be able to talk to systems on the 192.168.4.0/24 network.


What's the ``24'' at the end of that address.

> If you run a DHCP server (not the simple DHCP server option on a home-
> class router) on your network, check if it handles a classless static
> route option (scope option 249 on Microsoft's DHCP server). This option
> can ease administration by letting DHCP configure client routing tables.
> From my brief research on this, it's not clear, but I think only some
> Microsoft DHCP clients (XP, Windows 2003) support this option. ISC's DHCP
> Client doesn't appear to support this option, however, ISC's DHCP Server
> can support this option. You would need to define it.
>
> http://lists.freebsd.org/pipermail/f...uestions/2005-
> December/107071.html
>
> You can also try to have routes automatically added when interfaces are
> brought "up".
>
> http://listas.softwarelibre.cu/piper...ly/038063.html


Thank you, Ron. I'll try your suggestion.
 
Reply With Quote
 
b_dutta
Guest
Posts: n/a

 
      07-29-2008, 02:04 PM
On Jul 29, 10:40*am, "lovecreatesbea...@gmail.com"
<lovecreatesbea...@gmail.com> wrote:
> > # route add -net 192.168.4.0 netmask 255.255.255.0 gw 192.168.3.5

>
> > to be able to talk to systems on the 192.168.4.0/24 network.

>
> What's the ``24'' at the end of that address.


That's the no. of bits counting from the most-significant-bit position
(i.e. left side) that make up the network mask. So if you have an IPv4
address (which takes 32 bits to represent, 8 bits per octet in dotted-
decimal notation), then this means 3 octets full with 1's, and 1 octet
(LSB) with 0's.

HTH,
bani
 
Reply With Quote
 
lovecreatesbea...@gmail.com
Guest
Posts: n/a

 
      07-29-2008, 03:22 PM
On Jul 29, 10:04*pm, b_dutta <banibrata.du...@gmail.com> wrote:
> On Jul 29, 10:40*am, "lovecreatesbea...@gmail.com"
>
> <lovecreatesbea...@gmail.com> wrote:
> > > # route add -net 192.168.4.0 netmask 255.255.255.0 gw 192.168.3.5

>
> > > to be able to talk to systems on the 192.168.4.0/24 network.

>
> > What's the ``24'' at the end of that address.

>
> That's the no. of bits counting from the most-significant-bit position
> (i.e. left side) that make up the network mask. So if you have an IPv4
> address (which takes 32 bits to represent, 8 bits per octet in dotted-
> decimal notation), then this means 3 octets full with 1's, and 1 octet
> (LSB) with 0's.


Thank you.

Then 192.168.4.0/24 and 192.168.4.0/255.255.255.0 are equal for
192.168.4.0 is in ipv4 for sure. Am I right?
 
Reply With Quote
 
Baho Utot
Guest
Posts: n/a

 
      07-29-2008, 08:44 PM
lovecreatesbea...@gmail.com wrote:

> On Jul 29, 12:26Â*pm, Ronald Nissley <rnissley+use...@gmail.com> wrote:
>> On Mon, 28 Jul 2008 19:05:53 -0700, lovecreatesbea...@gmail.com wrote:
>> > Before I assigned more IP adresses for my machine to access those
>> > hosts. Can I use a proper netmask with only single IP address to do so?

>>
>> There is no "magical" netmask that will allow you to connect to these
>> other subnets. You need routes to get to these networks. For example, if
>> another system with IP address 192.168.3.5 has a second interface with
>> the address 192.168.4.1 assigned (and routes between the two networks),
>> then you would do something like:
>>
>> # route add -net 192.168.4.0 netmask 255.255.255.0 gw 192.168.3.5
>>
>> to be able to talk to systems on the 192.168.4.0/24 network.

>
> What's the ``24'' at the end of that address.


It's a 2 followed by a 4

--
Tayo'y mga Pinoy
 
Reply With Quote
 
Damiano Fasoli
Guest
Posts: n/a

 
      07-29-2008, 08:55 PM

Basically, you need to know HOW to reach them, i.e. which gateway/router
(see phisical connections) you have to contact; it must be a host with an
address 192.168.3.x and two network cards!

If you don't go to Internet from your Linux machine, perhaps
you have simply to change the gateway to the router LAN IP, and you'll have
both the access to Internet and to your private subnetworks.

Otherwise your gateway is OK and you'll have to setup static routes for
those destinations; so you can use your gateway for Internet Access again.

So, for example, if you can reach 192.168.4.10 via 192.168.3.50
set up a static route as root with
route add -host 192.168.4.10/32 gw 192.168.3.50

Again,
route add -host 192.168.5.11/32 gw 192.168.3.50
if the gateway is the same,

then
route add -host 192.168.10.12/32 gw 192.168.3.50
if the gateway is the same,

and to finish
route add -net 192.168.0.0/16 gw 192.168.3.50
if the gateway is the same.

If you need a permanent configuration you have to set up startup files
accordingly to your linux distribution for static routes in a similar
manner.

Regards
Dam

lovecreatesbea...@gmail.com wrote:

> My Linux machine is assigned the following network setting:
>
> address 192.168.3.101
> gateway 192.168.3.101
> netmask 255.255.255.0
>
> But I need to access hosts reside in other subnetworks
>
> address 192.168.4.10
> address 192.168.5.11
> address 192.168.10.12
>
> (address 192.168.x.x etc.)
>
> Before I assigned more IP adresses for my machine to access those
> hosts. Can I use a proper netmask with only single IP address to do
> so?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two wireless hosts under the same Access Point can't ping each other kAKOBAN Wireless Internet 5 04-18-2011 05:23 PM
Restricting access to internal hosts Dugg80 Windows Networking 1 11-12-2009 12:43 PM
Restricting access to internal hosts Dugg80 Wireless Networks 1 11-12-2009 12:42 PM
How to setup /etc/hosts to lookup DHCP client in the same subnet Wonder Linux Networking 4 09-12-2006 09:22 PM
filtering access via hosts.allow ebabin@yahoo.com Linux Networking 16 01-05-2006 11:12 PM



1 2 3 4 5 6 7 8 9 10 11