# Crossover ethernet network sharing

## avolkov

Hello everyone. I plan to use gentoo on a linux robot I am developing, but I am having install issues. The motherboard I'm using is kept near an archlinux pc that has working wifi access and an open ethernet port (network is managed by networkmanager). I need internet in the livecd environment on the target motherboard which only has a single ethernet port run by a Realtek RTL8111/8168B chipset. So, i bought a crossover cable wanting to connect the two and set up some sort of network sharing mechanism. I found a couple of similar situations around the web, but none have worked. I am pretty sure that the arch pc has a working ethernet driver, and from what I can tell from running ifconfig and net-setup on the gentoo target mobo (livecd), eth0 is created automatically and the ethernet chipset loads the r8169 driver. Can anyone help out?

----------

## chiefbag

Im not exactly sure I follow the actual hardware setup you have, but from what you have said I imagine you have a pc running linux and a development board/robot that you wish to install Gentoo on, is this a correct summery?

----------

## avolkov

Sorry for the poor description. But yes, I have a linux pc with internet access and a separate development board that I want to install gentoo on. 

So

Wifi --> Arch Linux PC --> (crossover ethernet) --> development board (w/ gentoo livecd)

----------

## depontius

Pardon me if I'm off, but it sounds as if you're doing the right stuff with 2 ethernet ports and a crossover cable, but kind of fell off the edge of the Earth after that.

You need to "tell" the two systems about the network.  You can do this by either setting both systems up for static IP, or venture into zeroconf.  It's possible that zeroconf will "just work" once you've installed the software, but I've never fiddled with it.  You need to know a bit about basic networking to set up static IP.

The first step here is to understand where you're starting from, so you can get useful information without being either confused or talked down to.

----------

## NeddySeagoon

avolkov.

I read your situation as needing to use another PC as your next 'hop' towards the internet.

There are two solutions if you can get more IP addresses in the same range as the one you have on your arch box. 

That allows you to set up PPP on each end of your crossover cable.

You will also need a script to bring the PPP interface up, set up forwarding and so on. I can post that if you need it.

If you can't have those IP addresses, you are forced to use NAT on your arch box.  Thats harder to set up.

On Gentoo, you follow the Home Router Guide I have no idea how to do that on arch.

That guide is written assuming that routing is all the system will bo but you can add that functionality to any system.

This will gibe you a dhcp server on your embedded facing interface and it will all just work.

----------

## chiefbag

@avolkov

For a minute lets forget about the network setup, What exactly is the development board you are using?

Have you been able to boot a livecd/usb on this board?

What access do you currently have to this board is it a serial access or do you have ssh access etc.

Is it currently running linux?

----------

## avolkov

@chiefbag

It's an atom d525 mini-itx motherboard. Yes I am able to boot into a gentoo64 minimal cd off of a usb drive. I can connect my arch linux pc's monitor's vga cable to the motherboard to get direct access to the livecd, but it's a hassle and I lose internet access, which is why I want to use a crossover cable to share the network and be able to ssh into the board from my work computer in a different room (within the same home network). 

@neddy

What do you mean IP addresses in the same range? I should point out that the arch pc uses DHCP if it makes a difference.

----------

## chiefbag

Can you not just connect an ethernet cable from the development board to your home router if there is an ethernet port on the development board. 

I assume that you can connect a keyboard to the dev board then all you need to do is start eth0 and sshd and mote the ip. 

You should then be able to ssh from your usual pc.

Note there is a 2011 Livedvd out now which you could use instead of the livecd or use SysRescue cd on a USB that will allow you to browse the internet etc while installing.

----------

## avolkov

I'm fine with the minimal livecd. My router is in a far away room. The *only* way to get internet on the dev board is somehow from the arch pc next to it. I wish this would be as easy as hooking up a connection thru my router and ssh'ing - I've done a number of installs that way, including a gentoo install. But I'm asking specifically how to get network sharing over a crossover cable.

----------

## chiefbag

Here is a config that will work with a hub or switch not sure about a direct crossover cable but the theory should be the same.

On the gentoo livecd edit the /etc/conf.d/net and add below then restart eth0

```
config_eth0=( "192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255" )
```

Not sure about your arch linux box but you will need to find out how to set a static ip and add a route.

If it were gentoo the config would be as follows.

```
config_eth0=( "192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255" )
```

Hope this is of use.

[/quote]

----------

## NeddySeagoon

avolkov,

If your wifi gets a public IP address on wlan0 somehow, can you get two more IP addresses in the same subnet as the address on wlan0.

If wlan0 connects to your ISP, the answer is probably no.  If wlan0 gets an IP in a private (unroutable) range, eg 10.x.x.x or 192.168.x.x then the answer is maybe.

If you control there private IP addesses, the answer is yes.

What chiefbag suggests should get a network up between your arch and gentoo but it will not get your gentoo onto the internet, as you cannot send 192.168.x.x packets to the outside world. They will be dropped at your ISP.  Somewhere you need Network Address Translation. Your arch box may need to do it or you may be able to pass it further along your network.

----------

## avolkov

Hmm. Let me try what chiefbag suggested to make sure my drivers are running properly. I am pretty sure the wlan0 ip is in the 192.168.x.x range, as it connects to my router behind a cable modem (if that helps).

----------

## chiefbag

@NeddySeagoon

That a good point, I generally tend to overlook the fact that your isp may be directly assigning ips to all your internal devices depending on your isp's router.

This is painful and I have recently come across this in a friends house but did not take much notice of it until you mentioned it.

In most installations that I have come across at least in Ireland the subnet is a private range and has no direct relation to the dynamic or static isp public ip, this makes internal LAN setups a lot simpler. I recently noted on services provided by MMDS systems that all internal ips are actually dynamic public ips or at least seem to be public ips, this would bring into the the equation the need for setting up a home router to create a private LAN and NATing firewall.

Sorry for the rant but as Neddy suggests check the ip on the Wifi card and if its a private ip range then match it to the previous config as I suggested. Failing that you will need to setup another route to allow access from the dev/robot through your arch box to your Wifi card.

----------

## avolkov

This was really supposed to be a quickfix to make my life simpler during the gentoo install. I tried what you suggested chiefbag but now when I ping'd the arch pc it said something along the lines of no connection was found or something. A glance at my ethernet port on the robot mobo told me that the ethernet wasn't even recognized (the light was off). Anyway, I became suspicious that the driver wasn't loading automatically so I ended up bringing the setup over to my router that's next to my main pc and hooking it in directly. Turns out everything loads up fine now, so the driver was alright. I think I'll just leave the setup here for now and return to the crossover cable dilemma post-install. Thanks for the help everyone.

----------

## Mad Merlin

If your wifi was actualy wired, you could simply bridge the two ethernet devices together and be done with it (both machines would be directly on the network). Unfortunately, this doesn't work with most wireless cards.

----------

## NeddySeagoon

avolkov,

For when you come back, as you have plenty of IP addresses in your wlan0 net, you can go the PPP route.  You do not need your arch box to provide NAT.

You will need to poke about in your wifi router, to looks at the dhcp range that is set because you will need two IP addresses outside of that range.

These will get allocated statically to each end of the PPP link. One to your arch eth0 and one to your embedded system.

----------

