LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Two machines LAN configuration in Slackware plus internet. (https://www.linuxquestions.org/questions/slackware-14/two-machines-lan-configuration-in-slackware-plus-internet-4175450090/)

stf92 02-14-2013 01:06 AM

Two machines LAN configuration in Slackware plus internet.
 
Hi:

The problem: A modem-router, a switch and two computers. The switch is connected to the modem-router and the two computers, and I want the computers to communicate between them and one of them, say computer A, to have access to internet (the modem-router is fed by the ISP). Let the other be computer B.

I've been reading The Linux Network Administrator's Guide, 2nd edition and /usr/doc/Linux-HOWTO/Linux+IPv6-HOWTO, but still can't figure out how to solve this problem.

As I see it, its a case of assigning one IP to A and another to B. This would do for address resolution. And could be done with ifconfig, though I do not know how (yes, I studies the man page).

What I did was to just forget about the modem-router (Motorola Surfboard SB5101i) and join the computers by means of the switch. I did 'ifconfig eth0 xxx.xxx.1.1' and 'ifconfig eth0 xxx.xxx.1.2' on B, where I chose xxx.xxx arbitrarily. Then, I verified with ping. This I did trying to simplify the problem, only to test. However, I was not able to login into the other machine. As you can see, my knowledge on LAN is insufficient, so I would not be entitled to ask for help here. If you think otherwise, please let me know.

net-tools 1.60
ifconfig 1.42 (2001-04-13)
Linux 3.2.29
Slackware 14.0

WiseDraco 02-14-2013 01:31 AM

Quote:

Originally Posted by stf92 (Post 4891300)
Hi:


What I did was to just forget about the modem-router (Motorola Surfboard SB5101i) and join the computers by means of the switch. I did 'ifconfig eth0 xxx.xxx.1.1' and 'ifconfig eth0 xxx.xxx.1.2' on B, where I chose xxx.xxx arbitrarily. Then, I verified with ping. This I did trying to simplify the problem, only to test. However, I was not able to login into the other machine. As you can see, my knowledge on LAN is insufficient, so I would not be entitled to ask for help here. If you think otherwise, please let me know.

net-tools 1.60
ifconfig 1.42 (2001-04-13)
Linux 3.2.29
Slackware 14.0

it's more easy to designate address via /etc/rc/d/rc.inet1.conf

it contains some like:

# Config information for eth0:
IPADDR[0]="192.168.3.55"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

# Config information for eth2:
IPADDR[2]=""
NETMASK[2]=""
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""

# Config information for eth3:
IPADDR[3]=""
NETMASK[3]=""
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""

# Default gateway IP address:
GATEWAY="192.168.3.254"

edit it with your own settings, save, and restart computer ( or do command: /etc/rc.d/rc.inet1 restart ). if you do not want setting done via manual, as i remeber commands is like ifconfig eth0 192.168.1.2 mask 255.255.255.0
then do add gateway: route add default gw 192.168.1.1
then it be must works. both computer must be in one subnet ( if netmask is 255.255.255.0 ( "c" class netmask, or /24), then ip adress range for both is like a 192.168.1.x, where x= 1 to 254 ) in example, give A computer 192.168.1.1, and B one - 192.168.1.2. netmask on both is 255.255.255.0 after you do that, you must can ping each other from both machines, if it be connected physically with ethernet cable ( crossed, or patch cables connected to ethernet switch).
also you do not want to hide your addresses, if it from 192.168.x.x range - it is "grey" address range for small private networks - it not routed to internet and not showing in global internet. when you connecting to inet, you must have a "real address", some like, for example, 60.50.104.45...
PS. why IPv6? do your cable provider use IPv6 ? :-O

Poucket 02-14-2013 02:25 AM

Quote:

PS. why IPv6? do your cable provider use IPv6 ? :-O
Hello stf92,

Wise Draco asks why you are reading a How-To about Linux+IPv6?
If you see in Chapter 2 (2.1) it explains how
IPv6 differs from IPv4.
The addresses you have set for your two
computers are 32-bit IPv4.

stf92 02-14-2013 02:33 AM

IPv6 must be an error of mine. Please forget about IPv6. Where do I put that "real address"? With 'ifconfig eth0 xxx.xxx.xxx.xxx'?

stf92 02-14-2013 02:38 AM

Quote:

Originally Posted by Poucket (Post 4891332)
Hello stf92,

Wise Draco asks why you are reading a How-To about Linux+IPv6?
If you see in Chapter 2 (2.1) it explains how
IPv6 differs from IPv4.
The addresses you have set for your two
computers are 32-bit IPv4.

Oh yes. Four 8-bit numbers, that is, binary bbbbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb or up to 255.255.255.255. You are right. And the computer when booting has trouble with 'IPv6 RAS'. So that was the trouble! But then it takes another course of action and seems to resolve. Otherwise I would not be speaking with you now. Thanks.

EDIT: by the way, when I had just bought the switch, I connected it to the modem and to this computer while the computer was running. And it, the computer, went on running as if nothing had happened. Perfect, said I, this works! Of course the other computer was not connected yet to the switch. However, I could NEVER again repeat these conditions! I wonder how I did it.

But this fact, that I continued having internet, does not say the modem is really a modem-router?

WiseDraco 02-14-2013 03:05 AM

switch is hardware mm...hard to say in english - but switch is like a electric spreader, splitter - it looks up transparent for network. router \ firewall is a bit different things -it in you must configure it, and it works with packet filtration, addr4ess translation and another complex things. do you done configure ip address on both machines, as i describe? after that, it pings each other?

Poucket 02-14-2013 03:07 AM

Quote:

Originally Posted by stf92 (Post 4891336)
But this fact, that I continued having internet, does not say the modem is really a modem-router?

It does not. Your Surfboard sb5101 should be a modem.

stf92 02-14-2013 03:10 AM

Yes, the five jacks are connected in parallel, I understand. There are no passive or active elements between the jacks.

pLease, give 5 more minutes.

stf92 02-14-2013 03:15 AM

Quote:

Originally Posted by Poucket (Post 4891345)
It does not. Your Surfboard sb5101 should be a modem.

Then all my posting here in LQ has been in vain! What a pity! It was TobiSGD who told it was a router too.

stf92 02-14-2013 03:24 AM

ifconf eth0 xxxxxxx.1 mask 255.255.255.0 gave 'mask: Host name lookup failure'. I have the same hostnames on both machines.

WiseDraco 02-14-2013 03:34 AM

Quote:

Originally Posted by stf92 (Post 4891360)
ifconf eth0 xxxxxxx.1 mask 255.255.255.0 gave 'mask: Host name lookup failure'. I have the same hostnames on both machines.

sorry, there have been "netmask" - i configured it many time ago. correct syntax is
ifconfig eth0 xxx.xxx.xxx.xxx netmask 255.255.255.0

on one machine in xxx.xxx.xxx.xxx do a 192.168.0.1, on another - 192.168.0.2
then make sure both of it is be connected to switch, and switch is turn on, and then make a ping 192.168.0.2 from first machine.

Poucket 02-14-2013 03:48 AM

Quote:

Originally Posted by stf92 (Post 4891352)
It was TobiSGD who told it was a router too.

It is complicated. There might be some way for you to use the modem
and switch as was discussed yesterday, but it would better IMHO
to follow the recommendation here.

stf92 02-14-2013 03:58 AM

OK. Both ifconfig done in each machine plus route command on A. After that, I pinged from each machine with no problem. What next?

WiseDraco 02-14-2013 04:08 AM

Quote:

Originally Posted by stf92 (Post 4891382)
OK. Both ifconfig done in each machine plus route command on A. After that, I pinged from each machine with no problem. What next?

what you want next? :) i think, it is goal, who you want - network connection between these two machines.
if you need also internet on one of your machines in the same time ( says, on machine A), then
go on /etc/rc.d/rc.local on that machine and write in rc.local new string with /sbin/ifconfig eth0:0 192.168.0.1 netmask 255.255.255.0

in machine B on /etc/rc.d/rc.inet1.conf writes ip 192.168.0.2 and gw 192.168.0.1

in that example means, a internet ( with modem and so) is always connect to machine A.
after reboot both machines you must going to internet from machine A, and ping from A to B, ant vice versa...
it is any another things, who you want? ;)

Poucket 02-14-2013 04:08 AM

What was your gateway for the route command? Or were you setting a route to B?

stf92 02-14-2013 04:11 AM

Quote:

Originally Posted by Poucket (Post 4891389)
What was your gateway for the route command? Or were you setting a route to B?

route add default gw 192.168.1.1 (this IP is A).

WiseDraco 02-14-2013 04:11 AM

Quote:

Originally Posted by Poucket (Post 4891389)
What was your gateway for the route command? Or were you setting a route to B?

in that etap route not need at all, i think, because in "internal network" is no further going \ routes.
gateway is need only if it must be routing via networks \ going to internet from machine B...

stf92 02-14-2013 04:39 AM

Quote:

Originally Posted by WiseDraco (Post 4891388)
what you want next? :) i think, it is goal, who you want - network connection between these two machines.
if you need also internet on one of your machines in the same time ( says, on machine A), then
go on /etc/rc.d/rc.local on that machine and write in rc.local new string with /sbin/ifconfig eth0:0 192.168.0.1 netmask 255.255.255.0

in machine B on /etc/rc.d/rc.inet1.conf writes ip 192.168.0.2 and gw 192.168.0.1

in that example means, a internet ( with modem and so) is always connect to machine A.
after reboot both machines you must going to internet from machine A, and ping from A to B, ant vice versa...
it is any another things, who you want? ;)

First, to thank you for your nice posts. Secondly, it seems to me the modem is really a modem-router because I am having internet through the switch! However, B machine gave errors when booting. I got
Quote:

Object "192.168.0.2" is unknown, try ip help
Maybe it is 192.168.1.2?

EDIT: on the other hand I have no gw on either 12.0 or 14.0.

WiseDraco 02-14-2013 04:48 AM

Quote:

Originally Posted by stf92 (Post 4891398)
First, to thank you for your nice posts. Secondly, it seems to me the modem is really a modem-router because I am having internet through the switch! However, B machine gave errors when booting. I got
Maybe it is 192.168.1.2?

maybe. it do not remember your adressing, first three digit groups must be the same on both machines, if your netmask is 255.255.255.0 i e on both machines you must be 192.168.0.x or or 192.168.1.x, not mixed.
about internet via switch - as i tell you agree, switch is transparent network device. no matter, your modem is connected to your ethernet port on computer, or via switch - it is be same thing, as so, there is no "modem router".
modem can be router if you can distribute internet from it to all your local computerts at the same time, on whole internal network. but as i understand, your router cannot be configured to have "lowered" address like 192.168.x.x and distribute internet access from that whole network...

gw on this stage not necessary, except that one, who goes from dhcp for machine connected to modem, and need in that case, for internet on it is working.

stf92 02-14-2013 04:52 AM

As to the gw command, I think you have made a typo. It is not in slackaware 14.0. What does it do?

Poucket 02-14-2013 04:57 AM

Quote:

Originally Posted by stf92 (Post 4891405)
What does it do?

gw is not a command. Correct. gw is an optional argument to route.

WiseDraco 02-14-2013 05:09 AM

Quote:

Originally Posted by stf92 (Post 4891405)
As to the gw command, I think you have made a typo. It is not in slackaware 14.0. What does it do?

nothing to do. it be automatic, as before that ( as i understand, your modem is working with your linux box, and internet is already working?)

stf92 02-14-2013 05:12 AM

Yes, internet working in A. Now, what is the syntax for 'route' in /etc/rc.d/rc.inet1.conf? I am at one inch of success.

Poucket 02-14-2013 05:17 AM

from man route(8):

Quote:

If you specify the address of one of your local interfaces, it will be used to
decide about the interface to which the packets should be routed to.
That might be what you have done with the gw argument.

stf92 02-14-2013 05:46 AM

Up to now I have done, in A:

# ifconf eth0 192.168.1.1 netmask 255.255.255.0
# route add default gw 192.168.1.1
Then in etc/rc.d/rc.local, I added line
/sbin/ifconfig eth0:0 192.168.0.1 netmask 255.255.255.0

Here A takes either 192.168.0.1 or 192.168.1.1 without complaining.

In B:
# ifconf eth0 192.168.1.2 netmask 255.255.255.0
Then in /etc/rc.d/rc.inet1.conf, I added line
ip 192.168.0.2

Here 'ip 192.168.0.2' and 'ip 192.168.1.2' both give errors.

Booted both A and B and I had internet in A. It's a pity such a good track I had at last found is really a dead end, though not your fault, of course. Anyway, to have understood that the switch is really transparent, in the same way as a splitter, is a very good thing. Of course, I can't now ping.

WiseDraco 02-14-2013 05:46 AM

Quote:

Originally Posted by stf92 (Post 4891421)
Yes, internet working in A. Now, what is the syntax for 'route' in /etc/rc.d/rc.inet1.conf? I am at one inch of success.

in /etc/rc.d/rc.inet1.conf conf on machine B write address, who you given in aliase ( eth0:0) for machine A. but link between A and B works also without that.

WiseDraco 02-14-2013 05:51 AM

Quote:

Originally Posted by stf92 (Post 4891443)
Up to now I have done, in A:

# ifconf eth0 192.168.1.1 netmask 255.255.255.0
# route add default gw 192.168.1.1
Then in etc/rc.d/rc.local, I added line
/sbin/ifconfig eth0:0 192.168.0.1 netmask 255.255.255.0

Here A takes either 192.168.0.1 or 192.168.1.1 without complaining.

In B:
# ifconf eth0 192.168.1.2 netmask 255.255.255.0
Then in /etc/rc.d/rc.inet1.conf, I added line
ip 192.168.0.2

Here 'ip 192.168.0.2' and 'ip 192.168.1.2' both give errors.

Booted both A and B and I had internet in A. It's a pity such a good track I had at last found is really a dead end, though not your fault, of course. Anyway, to have understood that the switch is really transparent, in the same way as a splitter, is a very good thing. Of course, I can't now ping.

oh, mai god! :D

machine A is with internet. do it in A:
in etc/rc.d/rc.local, I added line
/sbin/ifconfig eth0:0 192.168.0.1 netmask 255.255.255.0


in machine B do:
in /etc/rc.d/rc.inet1.conf

# Config information for eth0:
IPADDR[0]="192.168.0.2"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""


# Default gateway IP address:
GATEWAY="192.168.0.1"

then, restart both. after restart all must be worked.

Poucket 02-14-2013 06:03 AM

Quote:

Originally Posted by WiseDraco (Post 4891445)
oh, mai god! :D

machine A is with internet. do it in A:
in etc/rc.d/rc.local, I added line
/sbin/ifconfig eth0:0 192.168.0.1 netmask 255.255.255.0


in machine B do:
in /etc/rc.d/rc.inet1.conf

# Config information for eth0:
IPADDR[0]="192.168.0.2"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""


# Default gateway IP address:
GATEWAY="192.168.0.1"

then, restart both. after restart all must be worked.

And cross your fingers. It also helps. :confused:

WiseDraco 02-14-2013 06:11 AM

Quote:

Originally Posted by Poucket (Post 4891453)
And cross your fingers. It also helps. :hattip:


do not think so. it may help in any different cases, but in this is all are very,very basic and simple.
there is not need to cross fingers to get work that things, imho :)

Poucket 02-14-2013 06:15 AM

Quote:

Originally Posted by WiseDraco (Post 4891444)
in /etc/rc.d/rc.inet1.conf conf on machine B write address, who you given in aliase ( eth0:0) for machine A. but link between A and B works also without that.

Will machine B also have internet through the alias?

stf92 02-14-2013 06:24 AM

Alrihgt, both machines ping. This, believe it or not, is the fourth thread I open about the same subject and I had to wait for somebody like you to enter the scene to shed some light on the matter. For instance, nobody seemed to understand that the modem including router or not was immaterial. And I said before you said so: "it has to be very simple!". But idiomatic barriers and maybe some slowliness in me could have conspired to make this a large tread. Never mind, I drink to your health. Adieu,

Enrique.

P.S.: I expect this procedure, of which I have taken good note, enjoys the property of repeatability.

WiseDraco 02-14-2013 06:46 AM

Quote:

Originally Posted by Poucket (Post 4891459)
Will machine B also have internet through the alias?

in that situation, no. it can be make throught /etc/rc.d/rc.ip_forward make an executable, and make an /etc/rc.d/rc.firewall script like as


#!/bin/sh

echo "Starting Firewall & NAT "

IPTABLES="/usr/sbin/iptables"

#Flush all chains

$IPTABLES -F
$IPTABLES -t nat -F

# Erase all chains

$IPTABLES -X
$IPTABLES -t nat -X



#$IPTABLES -P INPUT DROP
#$IPTABLES -P OUTPUT DROP
#$IPTABLES -P FORWARD DROP

$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT

###IP Aliasing

#SNAT Section

### cannot use -i with postrouting!
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE


but that - firewalling, address translation and so - is another, big, topic...;)
and with situation as there, when outer ( internet) in inner network is one, it not be safe thing, imho. inner, private network must be physically separated from outer, and that require additional network card in A machine.

Poucket 02-14-2013 07:01 AM

Quote:

Originally Posted by WiseDraco (Post 4891479)
in that situation, no. it can be make throught /etc/rc.d/rc.ip_forward

I had not even seen rc.ip_forward in /etc/rc.d . I have been trying to understand how to bridge an RPi through
another computer with two network interfaces. Still working on it.

WiseDraco 02-14-2013 07:10 AM

Quote:

Originally Posted by Poucket (Post 4891491)
I had not even seen rc.ip_forward in /etc/rc.d . I have been trying to understand how to bridge an RPi through
another computer with two network interfaces. Still working on it.

rc.ip_forward must be in /etc/rc.d if you use slackware.
what is RPi ?

Poucket 02-14-2013 07:18 AM

Quote:

Originally Posted by WiseDraco (Post 4891493)
rc.ip_forward must be in /etc/rc.d if you use slackware.

Yes, the file was there.
Raspberry Pi is a little computer that will not take much space if you place it on a desk.

WiseDraco 02-14-2013 07:51 AM

looks nice, but i already have an eeepc900 for mobile tasks and so on :)


All times are GMT -5. The time now is 05:33 PM.