Local network?

I have two PCs, witch have Linux Ubuntu.
I want to connect those computers by a local network, but I know right anything about the network.

I have a modem (not router) and a router that i don't use.
The desktop pc have 2 network cards. (eth0 eth1). The modem is on eth1.

Anyone help me! Thanks in advance for any reply!! :slight_smile:

Assign a different IP address to eth0 on each of the machines, say 192.168.1.2 and 192.168.1.3
Connect the two network cards together with a cross over ethernet cable, or, if your router has multiple LAN ports, plug each computer network card into the LAN ports on the router with a standard ethernet cable.

1 Like

THANKS! :slight_smile:

Pc 1:

ifconfig eth0 192.168.1.2

eth1 connected to the modem

Pc 2: (only one Ethernet port)

ifconfig eth0 192.168.1.3

So; if i do a

ping 192.168.1.3

on the first PC, it should work.

Thanks again!! :slight_smile:

PS: there are differences between the cross-over Ethernet cable solution and the router solution? What is the fastest? Thanks!

PPS: On the pc2 should I see the Internet?

Not really if you're configuring your network statically.

No effective difference.

Nope. You asked about a local area network, this will let the two communicate with no internet access and does no routing.

If you just want to share your internet connection, a residential wireless router will do the job with less bother than trying to make one computer into a router. Plus you won't need to have one computer on 24/7.

1 Like

Mghis, if you want to share your Internet, you are need those commands
echo 1 >/proc/sys/net/ipv4/ip_forward - allow forward
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j MASQUERADE

eth0 - Internet interface
192.168.0.0/24 - your local network