Installing video4linux Beaglebone - ssh

I'm working on Beaglebone black on a project on image processing. For this purpose, I shall need video4linux application.
However, I'm not able to share my internet with the beaglebone because of which "sudo apt-get install v4l-utils" isn't working. Whenever I change the internet sharing settings, I'm unable to ssh into the local ip of the beaglebone.
Hence, I want a method where I can install video4linux without internet connectivity.

It will be very complicated if you want install package without internet as you need to install all the dependent package before the actual package.
Each package have dependency of other package.
Still you can download the package from :v4l-utils
And using WinSCP tool you can copy in Beagle-bone.
Other dependent package for debian you can find at:Debian Packages

You can also share internet from your host to beagle-bone via USB.
Follow this sh code:
On the BeagleBone
ifconfig usb0 192.168.7.2
route add default gw 192.168.7.1
On Linux computer:
sudo su
#eth0 is my internet facing interface, eth3 is the BeagleBone USB connection
ifconfig eth3 192.168.7.1
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth3 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

Related

How are the --network options available in podman?

I am running a virtual environment on CentOS with podman.
When I used the --net option of the podman run command, I get an error.
[user#server ~]$ podman run --net slirp4netns:port_handler=slirp4netns -p 1080:80 -d --name web nginx
Error: cannot join CNI networks if running rootless: invalid argument
Is this option unavailable?
Or is there a problem with the way the options are specified?
Please tell me solution.
I used this site as a reference for the command.
This is the configuration of the server.
[user#server ~]$ cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
[user#server ~]$ podman -v
podman version 2.0.6
The port_handler option requires Podman >= 2.1.0, which isn't released at this moment: https://github.com/containers/podman/commit/d86bae2a01cb855d5964a2a3fbdd41afe68d62c8
You can use that option if you compile Podman from its master branch.
I find this link quite helpful to see rootless communication :
https://www.redhat.com/sysadmin/container-networking-podman
https://podman.io/getting-started/network
I am not sure if you have seen this link before or even if it is helpful to you at this instance. But, in view of helping others out, I think the blog post quotes the following helpful statements:
Note: All podman network commands are for rootfull containers only.
Technically, the container itself does not have an IP address, because without root privileges, network device association cannot be achieved
When using Podman as a rootless user, the network is setup automatically. The container itself does not have an IP Address, because without root privileges, network association is not allowed. You will also see some other limitations.

Is it possible to use the nmcli in WSL and create a wifi hotspot?

I am trying to setup a wifihotpot on my laptop in ubuntu 18 running as a Windows Subsystem for Linux (WSL). (Terminal only)
Following basic tutorials I wanted to run the following command:
~$ nmcli device wifi hotspot con-name my-hotspot ssid my-hotspot band bg password 123456
Error: Could not create NMClient object: Could not connect: No such file or directory.
Trying to start the networkmanager also fails:
~$ sudo service network-manager start
* Starting network connection manager NetworkManager [ OK ]
~$ sudo service network-manager status
* NetworkManager is not running
I tried the networkManager after installing network-manager:
sudo add-apt-repository ppa:nilarimogard/webupd8
Is there another way to create a wifi hotspot from Ubuntu running as a WSL? Or does it not have the right access to the windows host to pull it off?
at this time, I don't believe it is possible according to https://github.com/microsoft/WSL/issues/2438. They designed WSL to ignore calls to set interface properties. So nmcli and other commands that changes interface properties are not working, they marked it as a bug and will fix it in the future.
"WSL currently ignores the call (which was intentional at the time of the design) to set interface properties" - sunilmut
I hope to help in some way :)

Is it possible to generate CAN message in one device and dump CAN message in another device using SocketCAN?

I am using SocketCAN and CANtact toolkit to send and receive CAN message. I am using two CANtact toolkits one to send CAN message and other to receive the CAN message both the CANtact toolkits are connected by DB9 female to DB9 female and the other ends are connected to the USB port of the laptop.
I used the following SocketCAN commands to first configure them
sudo modprobe can
sudo modprobe can_raw
sudo modprobe slcan
sudo slcand -o -s6 -t hw -S 3000000 /dev/ttyACM0 slcan0
sudo ip link set slcan0 up
The above commands are for the first CANtact toolkit then I connected the second CANtact toolkit and configured it with the following commands
sudo modprobe can
sudo modprobe can_raw
sudo modprobe slcan
sudo slcand -o -s6 -t hw -S 3000000 /dev/ttyACM1 slcan1
sudo ip link set slcan1 up
I performed these steps in two different terminals
In the first terminal, I gave
cangen -v slcan0
In the second terminal,I gave
candump slcan1
I don't receive any CAN messages in terminal 2 but if i give
cangen -v slcan0
in the first terminal and
candump slcan0
in second terminal I am able to view the CAN messages sent
This means the CAN message is not communicated between the two CANtact toolkits How can this be resolved? Or am I committing any mistake?
]5

Running OpenFlow on a PC?

I have a question about the running of OpenFlow switch:
If we want to run OpenFlow on such a PC or a router to work as an OpenFlow switch, what should we do for that?, and is the CPU type or platform of that device important? does it make any difference?
thanks in advance.
Before you try anything on a PC, Install Open vSwitch on a VM(probably Ubuntu) and try its OpenFlow functionality.
To install Open vSwitch(OVS) on ubuntu,
sudo apt-get install openvswitch-switch
You could get a controller like Floodlight or Ryu SDN framework to act as the controller for your switch.
Here is an OpenFlow tutorial. It is outdated but still informative http://archive.openflow.org/wk/index.php/OpenFlow_Tutorial
Or you could also try mininet as #EricSorensen suggested in the previous answer. Mininet allows you to simulate a network with hosts and switches.
While using mininet, you could use its inbuilt 'nox' controller. I'd prefer floodlight though.
Hope it helps!
This is all you need: http://mininet.org/
Check the downloads and tutorial. Use either a Virtual Machine, or native install from source (on Linux)
you can install openvswitch or use ofsoftswitch13 from https://github.com/CPqD/ofsoftswitch13 in a linux based PC with at least two physical interfaces.so that the packet routing can see.
Also using mininet https://github.com/mininet/mininet can run OF (for this one interface is enough) which supports the creation of various network topologies.
As suggested for testing you can simply do a apt-get install or similar on most recent Linux distros. There are two components to openvswitch, a kernel module and the user space openvswitch. The user space process does not require any specific number of cores or processor type and for the most part you can do with less than a core.
Apart from ovs you also need ovsdb, which apt-get install or similar will automatically set up for you (hence the easiest way to go about it). Again pretty lightweight its just a json key-value db.
For the controller there are a lot of options but for playing around you can use the built in command line tools as well.
ovs-apptctl: To setup the switch http://openvswitch.org/support/dist-docs/ovs-appctl.8.txt
ovs-oftcl: To add/mod/flows http://openvswitch.org/support/dist-docs/ovs-ofctl.8.txt
ovs-dpctl: To see the kernel flows
I would highly recommend getting a feel for the command line tools, OpenFlow commands and how flows work before picking Pox, Daylight etc.
Apart from mininet there is also Oftest (https://github.com/floodlight/oftest) that is primarily used to write tests for openflow but its pretty useful to learn and debug issues in a constrained environment.
Running OpenvSwitch
If you want to build OpenvSwitch with bare metal, I suggest you use official tarball to install OpenvSwitch daemon.
Please follow this step:
#/bin/bash
# In root permission
aptitude install dh-autoreconf libssl-dev openssl
wget http://openvswitch.org/releases/openvswitch-2.4.0.tar.gz
tar zxvf openvswitch-2.4.0.tar.gz && cd openvswitch-2.4.0
./boot.sh
./configure # If you want to build kernel module, please append --with-linux=/lib/modules/`uname -r`/build
make modules_install
modprobe gre
modprobe openvswitch
modprobe livcrc32c
ovsdb-tool create /usr/local/etc/openvswitch/conf.db /usr/local/share/openvswitch/vswitch.ovsschema
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,Open_vSwitch,manager_options \
--pidfile --detach --log-file
ovs-vsctl --no-wait init
ovs-vswitchd --pidfile --detach --log-file
You can use ovs-vsctl show of ovs-ofctl show to check OpenvSwitch status. Next step, we need to add physical or logical (likes veth pair) interfaces to OpenvSwitch bridge
# Create OpenvSwitch is named 'ovs-br'
ovs-vsctl add-br ovs-br
# Add interface to OpenvSwitch bridge
# If you want to check, please use `ovs-vsctl` to check again.
ovs-vsctl add-port ovs-br eth0
# Set OpenFlow controller
# You should ready one controller
# If not, I have two installation solutions can give you
# Ryu installation: https://github.com/sdnds-tw/ryu-installer
# ONOS installation: https://github.com/pichuang/onos-ansible
ovs-vsctl ovs-br set-controller tcp:x.x.x.x:6653
# Use ovs-vsctl to check controller attribute is UP
Once you let another server(here we call it controller) to determine the packet forwarding behavior of your local machine (here it is your PC), it turns into so-called SDN mechanism. So it's not relevant what kind of CPU or hardware you are choosing, basically, you can consider SDN as a software solution.
For the process to install the SDN-enabled software, you can choose open vswitch which has been answered in the above posts.

libvirt and VirtualBox / Getting Started

I'm trying to get started on libvirt with VirtualBox as a virtualization solution. I installed everything and VirtualBox itself is running when using their VBoxHeadless command.
However, libvirt fails to connect to VirtualBox:
# virsh -c vbox:///session
libvir: error : could not connect to vbox:///session
error: failed to connect to the hypervisor
I could not find any hints in the libvirt documentation that point to whether I have to make any domain specific configuration before using virsh.
Does anyone have a hint? Or even better, maybe a tutorial that works through the way of using libvirt, virsh or it's APIs (my later goal) from the ground up.
If you are doing this on Ubuntu, then the problem is their libvirt package is built without VirtualBox support.
You can rebuild the package with support very easily. Something like:
apt-get source -d libvirt
sudo apt-get build-dep libvirt
dpkg-source -x libvirt*dsc
Go into the libvirt directory and edit debian/rules so that instead of --without-vbox it says --with-vbox. You can add an entry to the top of debian/changelog so the package is compiled as a different version (e.g., append ~local1 to the version).
dpkg-buildpackage -us -uc -b -rfakeroot
You'll get new .debs built in the directory above. Use dpkg -i to install the relevant ones (libvirt0, libvirt0-bin, and whatever else you want).
Double-check whether or not you have write access to /var/run/libvirt/libvirt-sock.
The socket file should have permissions similar to:
$ sudo ls -la /var/run/libvirt/libvirt-sock
srwxrwx--- 1 root libvirtd 0 2010-08-24 14:54 /var/run/libvirt/libvirt-sock
I think it could be helpful also to increase the libvirt logging capabilities by running this in your shell:
export LIBVIRT_DEBUG=1
There is Ubuntu PPA for libvirt with VirtualBox support: https://launchpad.net/~cxl/+archive/ubuntu/libvirt