Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Connect two hosts manually point to point?[solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1698

PostPosted: Tue Jun 17, 2014 12:42 am    Post subject: Connect two hosts manually point to point?[solved] Reply with quote

I have a test Gentoo router box called 'router' and a web server called 'server' <snip edited out eratta..>So now I would like to connect the two with a simple point to point connection. However I am unsuccessful with the following:
The router nic lan0 is configured as 192.168.2.1 and the server nic eth0 is 192.168.2.2

On the router I ran
Code:
ifconfig lan0 192.168.2.1 netmask 255.255.255.252 up

and
Code:
route add -net 192.168.2.0 netmask 255.255.255.252 gw 192.168.2.2 dev lan0


on the server I ran
Code:
ifconfig eth0 192.168.2.2 netmask 255.255.255.252 up

Code:
route add -net 192.168.2.0 netmask 255.255.255.252 gw 192.168.2.1 dev eth0


Now on the server I can run
Code:
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.2.2  netmask 255.255.255.252  broadcast 192.168.2.3
        ether 00:03:47:0d:01:6e  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


and the router reports:
Code:
lan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.1  netmask 255.255.255.252  broadcast 192.168.2.255
        inet6 fe80::20e:cff:fecf:6abc  prefixlen 64  scopeid 0x20<link>
        ether 00:0e:0c:cf:6a:bc  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 2124 (2.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I am unable to ping either end.
I know I am missing something obvious! Like perhaps I need a cross over cable?
Thanks in advance!
_________________
Donate to Gentoo


Last edited by turtles on Wed Jun 18, 2014 1:43 am; edited 1 time in total
Back to top
View user's profile Send private message
massimo
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1226

PostPosted: Tue Jun 17, 2014 10:16 am    Post subject: Reply with quote

Do you have Gb ethernet otherwise you'd need crossover cabling. Apart from the you do not need to set up any additional routes.
_________________
Hello 911? How are you?
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Tue Jun 17, 2014 10:30 am    Post subject: Reply with quote

Unless you disabled it explicitly somewhere, both hosts will automagically get a link-local IPv6 address which should work fine for point-to-point communications.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 722
Location: Oslo, Norway

PostPosted: Tue Jun 17, 2014 1:23 pm    Post subject: Reply with quote

Have you tried to change either your netmask to 255.255.255.0 or your broadcast address to 192.168.2.3?
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1698

PostPosted: Tue Jun 17, 2014 8:00 pm    Post subject: Reply with quote

massimo wrote:
Do you have Gb ethernet otherwise you'd need crossover cabling. Apart from the you do not need to set up any additional routes.


I think I do
Code:
ethtool lan0
        Settings for lan0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: off (auto)
        Supports Wake-on: umbg
        Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes


chithanh
I am not familiar with how to use ipV6. Did they both did show an IPv6 link local address in my ifconfig output above?
EDIT no it looks like I did not support ipv6 when I did the kernel for the server.

pgu wrote:
Have you tried to change either your netmask to 255.255.255.0 or your broadcast address to 192.168.2.3?

No I dont think I did will as soon as the link to the server is back up it is down currently.
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54793
Location: 56N 3W

PostPosted: Tue Jun 17, 2014 8:06 pm    Post subject: Reply with quote

turtles,

Only the router has
Code:
inet6 fe80::20e:cff:fecf:6abc  prefixlen 64  scopeid 0x20<link>
which is an IPv6 link local address.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1698

PostPosted: Tue Jun 17, 2014 10:35 pm    Post subject: Reply with quote

NeddySeagoon wrote:
turtles,

Only the router has
Code:
inet6 fe80::20e:cff:fecf:6abc  prefixlen 64  scopeid 0x20<link>
which is an IPv6 link local address.


Thanks Neddy I think I do remember leaving ipv6 off in the server kernel.

The WAN to the server is currently still down I can get to the router though.

I look forward to understanding the broadcast address better
I tried 192.168.2.3 on the router as that is what the server is set to.

I have installed a ipcalc
and it tells me:
Code:

ipcalc 192.168.2.2
Address:   192.168.2.2          11000000.10101000.00000010. 00000010
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=>
Network:   192.168.2.0/24       11000000.10101000.00000010. 00000000
HostMin:   192.168.2.1          11000000.10101000.00000010. 00000001
HostMax:   192.168.2.254        11000000.10101000.00000010. 11111110
Broadcast: 192.168.2.255        11000000.10101000.00000010. 11111111
Hosts/Net: 254                   Class C, Private Internet


So perhaps the broadcast needs to be 192.168.2.255 ?

also I probably need to configure iptables on the router better.
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1698

PostPosted: Wed Jun 18, 2014 12:01 am    Post subject: Reply with quote

Thanks everyone for your help
It turns out the interface on the server was eth2
for reference how I determined that was:
Code:
cat /sys/class/net/eth2/carrier

eth0 on the server turned out to be a fiber link I forgot about
Code:
cat: /sys/class/net/eth0/carrier: Invalid argument

showed it was not connected.

Now to see if I can use iproute2 and iptables to forward a few ports over this link :)

On the server I did end up using:
Code:
inet 192.168.2.2  netmask 255.255.255.0  broadcast 192.168.2.255

_________________
Donate to Gentoo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum