Main Content

Enable Development Computer Communication (Linux)

To communicate with the target computer by using Ethernet, perform a one-time configuration of your Linux® development computer Ethernet port to use a nonroutable static IP address of the form 192.168.x.x. The configuration process includes:

  1. Verify the physical connection of Ethernet interface to the target computer.

  2. Configure the Ethernet interface IP address and subnet by using an automated network manager service or configure it manually.

  3. Ensure that communication to the target computer is not blocked by a firewall or rules.

  4. Verify that the development computer can communicate with the target computer by using the ping command.

Verify Physical Connection of Ethernet to Target Computer

There are various schemes by which wired and wireless network interfaces are assigned names. These names are the underlying system labels such as eth0 or wlx800e1319c734. The first step is to ensure you find the correct Ethernet interface. This step is dependent on the Linux distribution that is installed on your development computer. Often, you can list the available interfaces by using the ls command:

ls /sys/class/net
enp6s0 lo vpn0 wlan0 eth0

In this example, eth0 is the physical Ethernet interface to which the Ethernet cable to the target computer is connected. Verify that the cable for this interface on the development computer is connected to the corresponding interface on the target computer.

Configure Ethernet Interface IP Address and Subnet

Configure the Ethernet interface on the development computer to use an appropriate subnet either manually or by using a network manager service.

If configuring the Ethernet interface by using management daemon software, there are some considerations that depend on the Linux distribution. Based on the distribution installed on the development computer, there are automated methods or services that can manage the network interfaces. For example, you could use a management daemon software, such as NetworkManager (NM) (network-manager and associated packages) or Wicd (wicd and associated packages). These managers include UIs and commands. To ensure a static IP address is set and ensure that the development computer IP and target computer IP are in the same subnet, refer to the manager documentation manuals.

In all the distributions, if the interface is not managed by an automated service, you can configure the interface manually.

If configuring the interface manually, you can do the majority of network setup by editing the interfaces configuration file at /etc/network/interfaces. In this file, you can assign your network card an IP address or use dhcp, set up routing information, set default routes, and set other interface features. Be sure to add interfaces that are started at boot time to the 'auto' line.

To manually modify the interfaces configuration file and set up an interface named eth0 for a development computer that uses IP address 192.168.7.2 and a default gateway 192.168.7.254, add these lines to the file /etc/network/interfaces:

auto eth0
iface eth0 inet static
address 192.168.7.2/24
gateway 192.168.7.254

Tip

Do not set the development computer IP address to the gateway IP address 192.168.7.1 (notice the .1 at the end). Using the gateway IP address as the address of your development computer is not supported for Simulink® Real-Time™ communications with your target computer.

Ensure Communication to Target Computer Is Not Blocked

By default, most Linux distributions do not have firewalls that block Ethernet communications to the target computer.

Ensure there is no firewall, such as iptables or ufw, that is configured to block the connection to the target computer. For example, the default Debian Linux installation comes with the program iptables that is configured to allow all traffic.

If your organization uses a firewall, add a rule to ensure network traffic to the target from the host is unaffected. For more information, see nftables.

Verify Development Computer Can Communicate with Target Computer

Verify that the development computer can communicate with the target computer by using the ping command. For a target computer with IP address 192.168.7.5, in the MATLAB® Command Window, type:

system('ping 192.168.7.5')
 
Pinging 192.168.7.5 with 32 bytes of data: 
Reply from 192.168.7.5: bytes=32 time<1ms TTL=255 
Reply from 192.168.7.5: bytes=32 time<1ms TTL=255 
Reply from 192.168.7.5: bytes=32 time<1ms TTL=255 
Reply from 192.168.7.5: bytes=32 time<1ms TTL=255 
 
Ping statistics for 192.168.7.5: 
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 
Approximate round trip times in milli-seconds: 
    Minimum = 0ms, Maximum = 0ms, Average = 0ms 

ans =

     0

Related Topics