Score:2

Configure only an ip address for an isolated eth0 attached to an ip cam

ca flag

I have ubuntu 20.04 server on a raspberry pi 4B. It is connected to my lan via wlan0, no problem, using netplan. It is monitoring some BLE devices. Now I want to connect an IP cam to my ethernet port. I want eth0 to have ip address 192.168.3.1. In the old days I would simply run ifconfig eth0 192.168.3.1 up in rc.local and also set up a cron job to make sure eth0 had not been dropped.

I would like to do this with netplan instead as part of learning this new system. Everything I find seems to screw up the routing. I want to leave everything alone except to assign the desired ip address to eth0. I know this should be trivial unless it is impossible. any help appreciated.

waltinator avatar
it flag
Explore https://netplan.io/ .
kr flag
Wouldn't the IP cam require DHCP?
dave fournier avatar
ca flag
no. it has a static ip address 192.168.3.45
Terrance avatar
id flag
Could you please [edit](https://askubuntu.com/posts/1389045/edit) your question with the contents of the Netplan file you tried? You can also still install `ifconfig` and get the system working with the old way by installing both `net-tools` and `ifupdown` but if you are going to go with those you would have to remove or disable Netplan.
raj avatar
cn flag
raj
I assume you don't have Network Manager GUI on your system? Because with GUI it's trivial.
dave fournier avatar
ca flag
Actually I just wanted to know if there was a simple way to do it with netplan. I know about the workarounds. In the meantime I added a system D service which just runs a script to use ifconfig and also added a cron job to check if the interface has been dropped and assign the ip address to it again. BTW I am an old Linux user. Remember soft landing software?
Score:0
us flag

The netplan equivalent of ifconfig eth0 192.168.3.1 up is:

network:
  renderer: networkd
  version: 2
  ethernets:
    eth0:
      addresses: [ "192.168.3.1/24" ]
dave fournier avatar
ca flag
OK, thanks for that. It appear to work perfectly.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.