Tuesday, November 5, 2024

How to Connect Two PC via SLIP Using A Null-Modem Cable on Linux

In this article we’ll describe how to connect two PC via SLIP protocol using a null-modem cable. After this procedure, the two PCs will be connected and the IP protocol will be available for interworking, so using IP applications (e.g. telnet, ftp, ping) will be possible.

The project scenario is shown below:

Requirements:

  • 2 PC with a serial port available and Linux installed (tested with RedHat Linux 7.3)
  • 1 serial null-modem cable

Step-by-step procedure:

  1. Turn off PCs and connect null-modem cable to their available serial ports
  2. Turn on PCs. Linux will start
  3. On PC1: At the Linux prompt, execute:

    # slattach -p slip -s 115200 /dev/ttyS0 &

    This command creates a new network interface associated with serial port 1 (COM1, in Linux ttyS0. COM2, in Linux ttyS1). Its ID is “sl0”.

    Options:

    The “-p” option sets the interface protocol. In this case SLIP (Serial Link IP). “-s” option sets interface speed. In this case 115200 (fast serial port 16550). If the cable is not good, lower speeds are preferred. This improves quality and reliability. Don’t forget the “&” option. This executes the command as a background process so you can run other commands.

    Now, execute:

    # ifconfig sl0 192.168.0.1 pointopoint 192.168.0.2 up
    This command configures the network interface “sl0” as a point-to-point link. It specifies IP addresses to which the link is attached. It also sets the interface in up state.

    Now, execute:

    # route add -host 192.168.0.2 dev sl0
    This command configures a new entry in the Linux static route table. This entry sets the interface used by Linux to send packet to the host with IP address “192.168.0.2”.

    Now, PC1 is configured to use the P2P link.

  4. On PC2: At the Linux prompt, execute:

    # slattach -p slip -s 115200 /dev/ttyS0 &
    This command creates a new network interface associated with serial port 1 (COM1, in Linux ttyS0. COM2, in Linux ttyS1). Its ID is “sl0”.

    Don’t forget the “&” option. This executes the command as a background process so you can run other commands.

    Now, execute:

    # ifconfig sl0 192.168.0.2 pointopoint 192.168.0.1 up
    This command configures the network interface “sl0” as a point-to-point link. It specifies IP addresses to which the link is attached. It also sets the interface in up state.

    Now, execute:

    # route add -host 192.168.0.1 dev sl0
    This command configures a new entry in the Linux static route table. This entry sets the interface used by Linux to send packet to the host with IP address “192.168.0.1”.

  5. Now PC2 is configured to use the P2P link. If all is operating correctly, the PCs are networked and now you are able to use telnet, ftp, ping, etc.

    This procedure has to be done each time you start Linux. It’s good to insert these command lines at the bottom of configuration file “etc/profile” so they’ll be executed at startup.

    First appeared at DBAOnCall.net.

    DBAonCall.net is an online journal that covers the fundamental and
    essential tasks of Oracle administration. Although it includes information
    designed for people who are new to Oracle world, some materials extend
    beyond the basis. The primary goal is to make database administration
    straightforward – thats why we built DBAonCall.net from a task-oriented
    perspective. It covers all aspects of Oracle administration: general
    concepts, internal structure, and guiding assumptions, as well as the
    commands, procedures, strategies and policies essential to success as a
    DBA.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles