lunes, 30 de diciembre de 2013

SLIP connection between two linux boxes

Well. Assuming that you have serial ports in you linux PC use this command:

slattach /dev/ttyUSB0 -p slip -s 115200 -dL &


linux-edfh:/home/ghgv/Escritorio #
slattach: tty_open: looking for lock
slattach: tty_open: trying to open /dev/ttyUSB0
slattach: tty_open: /dev/ttyUSB0 (fd=3) slattach: tty_set_speed: 115200
slattach: tty_set_databits: 8
slattach: tty_set_stopbits: 1
slattach: tty_set_parity: N
slip started on /dev/ttyUSB0 interface sl0


this will create a sl0 interface that you will assign an ip address so:

ifconfig sl0 192.168.4.3/24

linux-edfh:/home/ghgv/Escritorio # ifconfig
eth0      Link encap:Ethernet  HWaddr 90:2B:34:9B:28:F8
          inet addr:192.168.1.113  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::922b:34ff:fe9b:28f8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10657 errors:0 dropped:7 overruns:0 frame:0
          TX packets:8060 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12578920 (11.9 Mb)  TX bytes:1208599 (1.1 Mb)
          Interrupt:40

eth1      Link encap:Ethernet  HWaddr 00:A0:FF:FF:58:33
          inet addr:192.168.3.1  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::2a0:ffff:feff:5833/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:44 dropped:0 overruns:0 carrier:86
          collisions:731 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:10609 (10.3 Kb)
          Interrupt:20 Base address:0xbf00

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:16436  Metric:1
          RX packets:2931 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2931 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:224671 (219.4 Kb)  TX bytes:224671 (219.4 Kb)

linux-edfh:/home/ghgv/Escritorio # ifconfig sl0 192.168.4.3/24
linux-edfh:/home/ghgv/Escritorio # ifconfig
eth0      Link encap:Ethernet  HWaddr 90:2B:34:9B:28:F8
          inet addr:192.168.1.113  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::922b:34ff:fe9b:28f8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10728 errors:0 dropped:7 overruns:0 frame:0
          TX packets:8153 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12604199 (12.0 Mb)  TX bytes:1224701 (1.1 Mb)
          Interrupt:40

eth1      Link encap:Ethernet  HWaddr 00:A0:FF:FF:58:33
          inet addr:192.168.3.1  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::2a0:ffff:feff:5833/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:44 dropped:0 overruns:0 carrier:86
          collisions:731 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:10609 (10.3 Kb)
          Interrupt:20 Base address:0xbf00

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:16436  Metric:1
          RX packets:2931 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2931 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:224671 (219.4 Kb)  TX bytes:224671 (219.4 Kb)

sl0       Link encap:Serial Line IP
          inet addr:192.168.4.3  P-t-P:192.168.4.3  Mask:255.255.255.0
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:296  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

linux-edfh:/home/ghgv/Escritorio #

In the other PC, you need to do the same:

linux-edfh:/home/ghgv/Escritorio # telnet 192.168.1.111
Trying 192.168.1.111...
Connected to 192.168.1.111.
Escape character is '^]'.
Welcome to openSUSE 12.1 "Asparagus" - Kernel 3.1.0-1.2-desktop (0).

linux-mqeo login: ghgv
Contraseña:
Último inicio de sesión:lun dic 30 18:51:31 COT 2013de consoleen :0
Have a lot of fun...
Directory: /home/ghgv
lun dic 30 18:52:50 COT 2013
ghgv@linux-mqeo:~> su
Contraseña:
linux-mqeo:/home/ghgv # slattach /dev/ttyUSB0 -p slip -s 115200 -dL &
[1] 6635
linux-mqeo:/home/ghgv # slattach: tty_open: looking for lock
slattach: tty_open: trying to open /dev/ttyUSB0
slattach: tty_open: /dev/ttyUSB0 (fd=3) slattach: tty_set_speed: 115200
slattach: tty_set_databits: 8
slattach: tty_set_stopbits: 1
slattach: tty_set_parity: N
slip started on /dev/ttyUSB0 interface sl0

linux-mqeo:/home/ghgv # ifconfig sl0 192.168.4.4/24
linux-mqeo:/home/ghgv # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:24:8C:73:EF:9B
          inet addr:192.168.1.109  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::224:8cff:fe73:ef9b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:202 errors:0 dropped:1 overruns:0 frame:0
          TX packets:131 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18947 (18.5 Kb)  TX bytes:15945 (15.5 Kb)
          Interrupt:41 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:E0:7D:89:C9:9C
          inet addr:192.168.3.3  Bcast:192.168.3.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:21 Base address:0x8c00

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:16436  Metric:1
          RX packets:30 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3959 (3.8 Kb)  TX bytes:3959 (3.8 Kb)

sl0       Link encap:Serial Line IP
          inet addr:192.168.4.4  P-t-P:192.168.4.4  Mask:255.255.255.0
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:296  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

wlan0     Link encap:Ethernet  HWaddr 00:11:D8:B7:D6:67
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::211:d8ff:feb7:d667/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:41 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4453 (4.3 Kb)  TX bytes:7683 (7.5 Kb)

linux-mqeo:/home/ghgv #
from the initial PC

linux-edfh:/home/ghgv/Escritorio # ping 192.168.4.4
PING 192.168.4.4 (192.168.4.4) 56(84) bytes of data.
64 bytes from 192.168.4.4: icmp_seq=1 ttl=64 time=18.3 ms
64 bytes from 192.168.4.4: icmp_seq=2 ttl=64 time=18.7 ms
64 bytes from 192.168.4.4: icmp_seq=3 ttl=64 time=18.7 ms
^C
--- 192.168.4.4 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 18.350/18.627/18.778/0.225 ms


There is no layer 2 information!!. No MAC addresses and the IP needs to be known for the SLIP to work

No hay comentarios:

Publicar un comentario