Search This Blog

Friday, November 4, 2011

TCP/IP over SLIP on GNU/Linux (Ubuntu)

As title, I need to implement TCP/IP stack on Embedded System that doesn't have Ethernet, only RS232. assume you understand what is TCP/IP over SLIP. If not, just google it.
The following shows how to setup your GNU/Linux PC running Ubuntu (hopefully, any version) to implement TCP/IP over SLIP, so you can test the other end. The example below will use 2 PCs running Ubuntu. Once you get it running, you can  replace one end with other device, in my case, my Embedded System.
Check if slip module is in your system:                                        
   $> find /lib/modules/$(uname -r) -name slip*                                 
Load slip module:                                                              
   $> modprobe slip                                                             
If you want to automatically load it during startup, edit:                    
Now, link Serial port with TCP/IP so we can access it using IP address. The example below using Serial port /dev/ttyUSB3 running at 115200bps.

   $> sudo slattach -p slip -s 115200 / dev/ttyUSB3 &
Check device name, look for something like sl0, sl1.                          
   $> ifconfig -a                                                               
Assume it's sl0, assign static IP address to it. Because SLIP is point-to-point connection, you also need to tell the IP address of the other end. The example below says, my Serial port sl0 is assigned IP address of and is connected to other end Serial port that is assigned IP address of

$> sudo ifconfig sl0 pointopoint up                                                                  
Repeat all of the above on the other end swapping IP addresses during ifconfig setup.
Try ping each other. If you are on                              
   $> ping                                                         
If you are on                                                    
   $> ping                                                         
If you find it too slow, try change the baudrate.                              
That's it. Try other program to talk to each other like web browser, telnet, ssh, etc. Once you know it's working, replace the other end with any device that supports TCP/IP over SLIP.
Hope you find it usefull.