0

I'm setting up a vision system using Ubuntu 16.04 with a number of GIGE vision cameras and two local networks. I have 6 GIGE ports on my computer to try and sort out and I'm not having much luck. I'm hoping that this is something fairly obvious that I'm missing.

To list them out:

  • enp0s31f6: Connects to the university network using dhcp
  • enp1s0: Connects to local instrument LAN (static IP, 192.168.175.x subnet)
  • enp2s0: Connects to GIGE camera (192.168.0.3)
  • enp3s0: Connects to GIGE camera (192.168.0.4)
  • enp4s0: Connects to GIGE camera (192.168.0.5)
  • enp5s0: Connects to GIGE camera (192.168.0.6)

My interfaces file so far is: # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback

# Primary interface
auto enp0s31f6
iface enp0s31f6 inet dhcp

# Secondary interface for vehicle comms
auto enp1s0
iface enp1s0 inet static
    address 192.168.175.13
    netmask 255.255.255.0
    gateway 192.168.175.1
    up route add -net 192.168.175.0 netmask 255.255.255.0 gw 192.168.175.1
    up route del default gw 192.168.175.1
    post-up route del -net 192.168.175.0 netmask 255.255.255.0 gw 0.0.0.0

#GIGE Port 1
auto enp2s0
iface enp2s0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1
    #post-up route del -net 192.168.0.0 netmask 255.255.255.0 gw 0.0.0.0
    #up route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
    mtu 9000

The problem I'm having is that the routes are terribly messed up. Right now they are:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 enp2s0
10.64.226.0     0.0.0.0         255.255.254.0   U     0      0        0 enp0s31f6
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 enp2s0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 enp2s0
192.168.175.0   0.0.0.0         255.255.255.0   U     0      0        0 enp1s0

Which isn't super helpful, since it now routes all traffic through enp2s0, which is only connected to a camera. I'm also not sure how to route only a single IP address through an interface.

Thoughts?

  • Do you really need those gateway statements on the not-primary interfaces? – thrig Jun 14 '17 at 23:21
  • I'm starting to wonder if I know what that statement does, I'd thought that told that particular interface which gateway to use. Although I'd redundant if I'm doing it later anyways.... – Fratink Jun 14 '17 at 23:30
  • Ahh yes, that seems to have fixed the problem of it creating the other networks as a default gateway. What seems to be happening now is that it creates a route for the secondary interfaces through the first (dhcp) interface. This is not what I'd like. – Fratink Jun 14 '17 at 23:36
  • Don't set gateway and route, that's all done automatically. What you need is a proper concept of how the IP addresses and subnets should be laid out. The important question is: What IP addresses do your cameras have? Where do they get this address from (statically assigned in their GUI, or dhcp)? After answering that, you can work out a concept. – dirkt Jun 15 '17 at 6:25
  • I agree that I need a better concept of how this all works, but they most definitely won't set the routes correctly without some direction. Everything gets routed through the default gateway by default. – Fratink Jun 15 '17 at 15:06
0

You should get a default gateway route for enp0s31f6 via DHCP and that should act as your connection with the outside world. The configuration for enp0s31f6 looks good.

For the other interfaces enp1s0, enp2s0, enp3s0, enp4s0 and enp5s0 remove any "gateway" lines from their configurations otherwise you will run into situations where your traffic will be routed on the wrong interface.

If all cameras have ip addresses on the same networks as your interfaces then you don't need to add any other routes in order to be able to communicate with them. If the cameras are on other networks then you need to add static routes on the respective interface which can reach those networks.

Examples:

  1. Camera and interfaces share the same LAN:

    # GIGE Port 1
    auto enp2s0
    iface enp2s0 inet static
        address 192.168.0.2
        netmask 255.255.255.0
        mtu 9000
    
  2. Camera is on another network (ex: 192.168.1.0/24) reachable through enp2s0 and the gateway to that network is 192.168.0.1:

    #GIGE Port 1
    auto enp2s0
    iface enp2s0 inet static
        address 192.168.0.2
        netmask 255.255.255.0
        up ip route add 192.168.1.0/24 via 192.168.0.1
        mtu 9000
    

The default route should connect you with the campus and the rest of the world but for any other destinations that you need to reach via the other interfaces use static routes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.