-2

I am trying to connect two ubuntu 14.04 pc to each other by using crossover cable. From network settings i gave IP addresses as ;(Ipv4 manual) PC1 - IP:10.0.0.1 Network Mask:255.255.255.0 PC2 - IP:10.0.0.2 Network Mask:255.255.255.0

PC1 is the server and it has apache installed. It serves pages from localhost. I wanted to see this web page from PC2 browser by typing IP1. However, my problem is starting from the beginning which I cannot even ping from PC1 to PC2 or vice versa.

results of "ifconfig"

PC1: eth2 Link encap:Ethernet HWaddr 40:a8:f0:5e:91:94

      inet addr:10.42.0.1  Bcast:10.42.0.255  Mask:255.255.255.0
      inet6 addr: fe80::42a8:f0ff:fe5e:9194/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:38 errors:0 dropped:0 overruns:0 frame:0
      TX packets:246 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:7569 (7.5 KB)  TX bytes:39911 (39.9 KB)
      Interrupt:20 Memory:ec200000-ec220000 

lo

      Link encap:Local Loopback  
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:933 errors:0 dropped:0 overruns:0 frame:0
      TX packets:933 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:74985 (74.9 KB)  TX bytes:74985 (74.9 KB)

PC2: eth2

      Link encap:Ethernet  HWaddr 40:a8:f0:5e:92:48 
      inet addr:10.42.0.40  Bcast:10.42.0.255  Mask:255.255.255.0
      inet6 addr: fe80::42a8:f0ff:fe5e:9194/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:467 errors:0 dropped:0 overruns:0 frame:0
      TX packets:460 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:64183 (64.1 KB)  TX bytes:54663 (54.6 KB)
      Interrupt:20 Memory:ec200000-ec220000 

lo

      Link encap:Local Loopback  
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:1380 errors:0 dropped:0 overruns:0 frame:0
      TX packets:1380 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:103299 (103.2 KB)  TX bytes:103299 (103.2 KB) 

iptables --list

Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere             state RELATED,ESTABLISHED
REJECT     udp  --  anywhere             anywhere             udp dpt:mdns reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             anywhere            
DROP       all  --  anywhere             anywhere             PKTTYPE = broadcast
DROP       all  --  anywhere             anywhere             PKTTYPE = multicast
LOG        all  --  anywhere             anywhere             state INVALID LOG level warning prefix " Invalid "
DROP       all  --  anywhere             anywhere             state INVALID
LOG        all  --  anywhere             anywhere             limit: avg 25/min burst 7 LOG level info prefix "#BANNED-BY-ROOT# "
DROP       all  --  anywhere             anywhere            

Chain FORWARD (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere             state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

Server has extra: Chain Input ACCEPT udp -- anywhere anywhere udp dpt:bootps ACCEPT tcp -- anywhere anywhere udp dpt:bootps ACCEPT udp -- anywhere anywhere udp dpt:domain ACCEPT tcp -- anywhere anywhere udp dpt:domain Chain Forward ACCEPT all -- anywhere 10.42.0.0./24 state RELATED,ESTABLISHED ACCEPT all -- 10.42.0.0./24 anywhere
ACCEPT all -- anywhere anywhere REJECT all -- anywhere anywhere reject-with icmp-port-unreachable REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

16
  • How are you configuring the IP addresses? Apr 4, 2015 at 21:28
  • I tried two options , 1. From edit connection and then IPV4 and i am selection manual for both 2. ifconfig eth0 192.168.5.1 from command line
    – Abendstern
    Apr 4, 2015 at 21:54
  • I mean with the network-manager (if yes, with the applet or with its configuration files), with /etc/network/interfaces, etc. Apr 4, 2015 at 21:56
  • For /etc/network/interfaces, i dont know how to do
    – Abendstern
    Apr 4, 2015 at 21:59
  • @mchid I am trying this in a university lab so to connect the normal system, Wpa-supplicant installed for all computer. (I have no idea what it is.)
    – Abendstern
    Apr 5, 2015 at 12:14

2 Answers 2

0

First, start over.

Insert the ethernet cable to both computers and on the server computer, click on network manager icon on your dash and select "edit connections".

Select auto eth0 and select ipv4 tab and then select connection-type "shared to other computers". Save changes and exit the menu.

Then, click on network manager and then click on the network auto eth0 to refresh the network or alternatively, run the following command:

sudo service network-manager restart

To obtain the ip of the server computer, click on network-manager and select "connection-information" to obtain the ip. Use this ip to access the server from pc2.


allow firewall access:

sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT 

and to allow ssh if you want that as well:

sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT 

[more info][1] [1]: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-iptables-on-ubuntu-14-04


To use ufw instead:

I tried this earlier today on a fresh install with ufw disabled. Set allow rules using ufw.

sudo ufw allow in 80/tcp
sudo ufw allow out 80/tcp

You can also set for udp but not needed here, this is just an example:

sudo ufw allow out 80/udp
sudo ufw allow in 80/udp

If you want ssh access:

sudo ufw allow out 22/tcp
sudo ufw allow in 22/tcp
6
  • Nope, again did not work. They took the ip but it is not returning a response for ping
    – Abendstern
    Apr 5, 2015 at 11:27
  • @Abendstern and dont forget to disable ufw and gufw because you need incoming and outgoing open not just outgoing
    – mchid
    Apr 5, 2015 at 11:31
  • 1
    I did the what u explained and server gave the IP address to client . I post the result of ifconfig to explain better :)
    – Abendstern
    Apr 5, 2015 at 11:41
  • for gufw, both PC says command command not found
    – Abendstern
    Apr 5, 2015 at 11:57
  • ufw, I have done already at the beginning
    – Abendstern
    Apr 5, 2015 at 12:02
0

Use an address of the 192.168.0.0/16 subnet, not 10.0.0.0/24, e.g. assign PC1 192.168.5.1 and PC2 192.168.5.2. 10.0.0.0/24 addresses might not leave the PCs because they're not routed.

3
  • Thanks for addresses. I want to ask one more thing to be on the safe side. There can be anything extra then address or not ? I mean to setup crossover connection i am just following the steps that i mentioned and plus i am disabling firewall (sudo ufw disable).
    – Abendstern
    Apr 4, 2015 at 19:51
  • Did you try what I wrote or are you asking before trying it? Setting the addresses is sufficient. Apr 4, 2015 at 20:07
  • I tried and it is not working same thing, I ping the other one and it just says nothing
    – Abendstern
    Apr 4, 2015 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .