Ubuntu 18 - Netplan - cloud.cfg disable issue - ubuntu-server

Using Ubuntu 18.04 Server LTS for an embedded application. Two physical network interfaces are present, one ethernet and one a PCI Athros wifi card. I can use netplan .YAML and ifconfig up/down to manually control and switch between interfaces.
I have added the 99-disable-network-config.cfg file with the contents:
network: {config: disabled}
to the /etc/cloud/cloud.cfg.d directory. Netplan apply has been run (multiple times)
I have one 01_xx.YAML file present in /etc/netplan that sets the Wifi adapter up to DHCP. The expectation is that the ethernet interface will remain down on a reboot. When I reboot I see the startup message that it is attempting to initialize the network and it times out after 2 minutes as failing. However as soon as I am at the CLI prompt I check the interfaces and I have both the ethernet and Wifi interfaces up and connected.
Is there a way to actually keep one of the interfaces down at startup? I want to only have one adapter being started based on the 01_xx.YAML I have set.
And then to keep the startup networking timeout from running to 2 minutes? I suspect this is part of systemd but I can't find it. This doesn't seem to be related to the dhclient.conf timeout parameter as I already have it set to 30 seconds.

Assuming you're using the networkd renderer, try adding optional: true to the device definition. This will tell systemd-networkd not to wait for it on boot.

Related

Ubuntu server 20.04 not detecting device over eth0

I am running a C# application on a ubuntu server 20.04 (running on a raspberry pi) which communicates with a controller. Both devices are connected via an ethernet cable and afterwards using a socket i search for its set ip 169.254.255.254 which remains always the same.
The application behaves the same as if the two devices are not connected throwing an exception "A socket operation was attempted to an unreachable network."
The connection worked on a raspberry pi os (latest version) but i can't use it because of a driver issue with a different component. I am also able to connect to the controller from a windows machine. Sadly i am very new to linux, ubuntu and networking and i can't figure out what could cause this issue.
Is there some kind of a setting that i need to set in order to be able to communicate with the controller?
If more information is needed please ask and i will provide.
Any IP within 169.254.x.x is problematic - in fact, according to this article, it indicates that the device is not connected to the network at all.

Oracle Linux, prevent Network Adapter from sleep when running in VirtualBox on macOS

I have installed Oracle Linux 7 with the current version of VirtualBox, running on mac OS Sierra with a macbook. It therefore has a battery but is plugged in at all times.
For networking I use 2 adapters, one NAT for internet and one Host-Guest for ssh etc.
For some time now I was always wondering why I would get a broken ssh pipe, trial and error showed me that the VM will go to sleep (black screen), which causes the network adapter to break, telling me the name of the adapter and simply Reset adapter as soon as I wake it up again by typing into the vm itself.
I can then restart the network adapter via /etc/init.d/network restart and it will work again
Any ideas how I can change that? My Linux skills are very limited and I am not even sure what Oracle Linux is based on, most tips I find online do not work, no GUI also makes it difficult to just hop into power settings or something similar
This worked for me, on Windows host machine.
Configure your network adapter to
1) Allow the network adapter to wake the computer,
2) Allow a magic packet to wake the computer,
3) Allow IPV6
http://www.worldstart.com/dropped-internet-connection-in-sleep-mode/
Now, when I sleep my computer, and then wake it up, I get networking on both the host and guest, not just host.

Configuration of a NIC from a Linux Bash Shell

I have a Dell laptop running the following version of RedHat Linux:
2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:02 EDT 2007 i686 i686 i386 GNU/Linux
It has an Ethernet-over-USB connection to a device under test (DUT). This interface to the DUT is usually configured as follows:
IP address: 104.4.40.2
Netmask: 255.255.255.0
Default gateway: 104.4.40.1
The default gateway points to the DUT.
Occasionally, I need to change the IP address / default gateway to 104.4.20.2 and 104.4.20.1, respectively. (The netmask remains 255.255.255.0).
I need to make this change when I load a new configuration onto the DUT that changes its IP address. (This configuration loading is done over a second interface that is unrelated to the interface I'm discussing here.)
When I make the corresponding change to the Linux box's network configuration using the GUI, everything works fine. But I often work remotely by shelling in via ssh. So, all I have available in that case is a Bash shell.
I've used command "ifconfig" (to set the IP address and netmask) and command "route" (to install the default gateway forwarding entry) to reconfigure the interface, and I then used "iconfig" to bring the interface down and back up to try to get the changes to "take".
When I check the interface settings with "ifconfig", they looks right. When I check the forwarding table with "route", everything looks good (including the default gateway). Yet, when I try to ping the DUT, I get no reponse. If I configure the interface yet again using the GUI, I can then ping the DUT.
I am clearly doing something wrong. Could someone please kindly show me the Bash shell command line commands I need to issue to change the IP address and default gateway of interface "eth1"?
Thank you in advance!
If I've got you right, you need these two simple commands:
vim /etc/sysconfig/network-scripts/ifcfg-eth1 //modify the configuration
service network restart
Also you can write a primitive bash/perl/python wrapper for your routines...
This answer may be useful for you too.

Connecting Two Linux System via Serial

I would like to connect two Unix Flavored System through Serial port. Can some one shed some light on this pleasE?
On one Machine I have a freeBSD installed and the other Machine I have installed Fedora 15.
The FreeBSD is where I will be initiating the connection and Fedora will be accepting the connection.
I have changed the run level on my Fedora so that It stops at command line. (i.e., set the run level to 3).
Both the Machines have com POrts (Male) and I connect them back to Back via Serial Cable (Both end Female Connectors)
Now from the FreeBSD Machine, I initiate a connection but i dont see the connection getting successful
I have disabled Firewall on my Fedora 15.
You need a "null modem" cable (or adapter), which crosses certain pairs of RS-232 lines. A straight pinout cable won't work because that will connect, for instance, CTS to CTS and RTS to RTS rather than CTS to RTS and vice versa.
Do you have a null modem adapter or cable in the connection chain?
Once you have a null modem, the next step is to verify the connectivity. This can be done in a number of ways. For instance, running a serial communications program such as Minicom on both ends, setting up the communication parameters (baud, bits, parity, handshaking ...) and seeing whether you can type characters on one side and have them appear on the other.
(You can also use stty < /dev/tty<whatever> <args> to view/change serial parameters, and echo and cat can be used.)
When the data link is thus working, you can think about setting up IP communication (other answer given).

Software serial port loopback on linux

Currently I need to develop some program that will communicate with cisco devices over serial line. I want to build testing environment on my development linux machine. So, I found dynamips cisco emulator. This emulator can provide interface via serial line with '-U /dev/ttyS0' option. Well, this causes dynamips to open hardware serial port and communicate via it. I'm able to connect to this hardware serial port from another linux machine with serial client like minicom.
However, since i'm using virtualbox for both linux machines, I link serial ports via virtualbox ability to forward serial port to named pipe. This scheme seems to be working, but very redunant. I'm looking for a method to run dynamips and minicom on a single linux machine.
I found that pseudo-terminals could be useful in my case. But I've tried to run dynamips with '-U /dev/ptmx' and then connect with minicom to created /dev/pts/... port and vice versa. In both cases I've got input/output error on both sides.
Unfortunately, modern pseudo-terminals aren't that easy. After opening the master with posix_openpt() or open("/dev/ptmx"), you must call grantpt() and unlockpt() on the master FD before it and its corresponding slave device are usable. (The openpty() etc. utility functions simplify this.)
As a workaround, the ever handy socat may be of use.
# terminal 1
socat pty:link=$PWD/pts unix-l:$PWD/ptm-pipe &
dynamips -U $PWD/pts
# terminal 2
socat unix:$PWD/ptm-pipe -

Resources