Disable multicast permanently for a specific interface on linux - linux

How to disable multicast permanently on a specific interface on linux ?
I'm on ubuntu server 22.04.
I tried to create a systemd .network file with the following configuration :
[Match]
Name=ens18
[Link]
Multicast=no
But ip link command still return that multicast is enabled.
What's the good way to disable multicast ? in netplan ? network/interfaces ? NetworkManager ? systemd network , sysctl.conf?

Related

Multiple IP address problem on debian/beagleboneblack

I'm working on a beaglebone black with a debian system and i want change my ip by modifying "/etc/network/interfaces", this is working but when I switch from DHCP method to static method my address, (atribuate by DHCP), is not "killed" so I end up with two IP addresses.
You need to stop and disable the DHCP client daemon.
How exactly this is done depends on which version of Debian you're using.
On older versions, which I suspect you're on, there is a dhcpcd service. Stop it with systemctl stop dhcpcd and disable it with systemctl disable dhcpcd.
Newer versions or alternate configurations with NetworkManager or systemd-networkd will need those services reconfigured.
I found a way, i just use ip addr flush eth0 after modified "/etc/network/interfaces" and before ifdown eth0 ifup eth0.

How can I use udhcpd to start a dhcp server on more than one nic?

I have a machine which running embedded Linux system, kernel version 2.6.37. It has a Wifi device and about 3 ethernets.
Now I want to start a dhcp server on this machine and then let is looks like a router. I hope each device connect to this machine via wifi/eth could dhcp to get ip and join in this LAN. These devices will have the same subnet and also could ping each other.
I try to use udhcpd to start the dhcp server. I write the udhcpd.conf as the following:
start 192.168.3.2
end 192.168.3.20
interface wlan0 eth0 eth1 eth2
But when I run "udhcpd udhcpd.conf -f", error occurred:
udhcpd (v1.20.1) started
udhcpd: max_leases=235 is too big, setting to 19
udhcpd: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
udhcpd: is interface wlan0 eth0 eth1 eth2 up and configured?: No such device
I checked the documents for udhcpd of busybox, but I can't find any information to talk about this situation.
You should bridge all interfaces to a bridge, then run udhcpcd on the bridge interface.
There is a guide on how to setup bridge
https://wiki.archlinux.org/index.php/Network_bridge

multicast traffic fails with virtualbox host only network

I have an application where it sends some multicast request to the multicast group ,
If I test my Client and Server application on two separate PC which are in same subnet it works fine .
Since I can not run always on two PCs during testing of my application, I thought of using the virtualbox to run the another OS to run my server application .
My Host is ubuntu , I installed the vitrtualbox to run the another guest os linux , and since my traffic only has to be with in the HOST and Guest , I have selected a "host only network type" .
My guest OS get the IP address but when I run my server application, It fails to join to the multicast group says
"No Such Device" .
Can someone help me to set up a network between the Guest and HOST OS ..
My main goal is to send a multicast request and it should reach the guest OS.
In VM:
ls /sys/class/net - get net devices. (lo, eth0, eth1...). You should have one lo and two eth devices.
sudo nano /etc/network/interfaces. At eth0 there is a NAT connection. Lo is a localhost. We should set the Host-Only connection. Add the following:
# The host-only network interface
auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255
(Address is taken from ipconfig/ifconfig output in host system. Instead eth1 you can have another connection name, taken from the step 4.b.i)
For checking the edited file, run:
sudo service network-manager restart
Check if you have all three connections running. Check Host-Only addresses.
ifconfig
Reboot
sudo reboot

Using tor over ssh on virtual network

I have two Machines running in VirtualBox, Ubuntu 12.04 LTS with two network adapters (NAT,Internal Network) and Kali Linux with one adapter (Internal Network). I'm also running tor ( SocksPort 9150, ControlPort 9151 ) in Ubuntu. My goal is to have access on the internet from Kali only through tor. So I used ssh port forwarding from kali to ubuntu and also configured firefox to use proxy( 127.0.0.1 - 9150)
kali~# ssh -N -L 9150:10.0.3.2:9150 root#10.0.3.1
With this command i am trying to forward all the traffic into tor.
The connection is established according to netstat and ping is working but when i try to load a page nothing happens and i keep getting the same error message on Kali's terminal
channel 2: open failed : connect failed : connection refused
Am i missing something? Do i need to open a port?
I also tried to use a SOCKS proxy with
ssh -D 9150 root#10.0.3.1
but it didn't work. Please share your thoughts with me, I am waiting for your insights.Thank you.
Internal Network Configuration:
Ubuntu:
IP:10.0.3.1
Broadcast Address:10.0.3.255
Subnet Mask:255.255.255.0
Default Route:10.0.2.2
Primary DNS:192.168.1.1
Kali:
IP:10.0.3.2
Broadcast Address:10.0.3.255
Subnet Mask:255.255.255.0
NAT Configuration:
Ubuntu
IP:10.0.2.15
Broadcast Address:10.0.2.255
Subnet Mask:255.255.255.0
Default Route:10.0.2.2
Primary DNS:192.168.1.1

Xen configure host-only adapter

Xen hypervisor has 2 modes for network configuration as I've seen in Virtual Manager. 1 NAT 2 Routed. Both ask for IP Subnet. However i want to configure a network where i could assign any IP instead of being assigned by DHCP of Xen.
I've use oracle Virtual Box there is an option to use Host-only adapter. I want to use Xen in that way.
In other words i want to share physical network interface to guest machine(VM)
I'm using Xen Hypervisor 3.x on CentOS 6.2 x86_64
I did the following to solve the issue this worked for me.
Disabling Xen's network scripts
If using Xen it is recommended to disable its network munging by editing /etc/xen/xend-config.sxp and changing the line
(network-script network-bridge)
To be
(network-script /bin/true)
Disabling NetworkManager
As of the time of writing (Fedora 12), NetworkManager still does not support bridging, so it is necessary to use "classic" network initscripts for the bridge, and to explicitly mark them as independent from NetworkManager (the "NM_CONTROLLED=no" lines in the scripts below).
If desired, you can also completely disable the NetworkManager:
# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start
Creating network initscripts
In the /etc/sysconfig/network-scripts directory it is neccessary to create 2 config files. The first (ifcfg-eth0) defines your physical network interface, and says that it will be part of a bridge:
# cat > ifcfg-eth0 <<EOF
DEVICE=eth0
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
EOF
Obviously change the HWADDR to match your actual NIC's address. You may also wish to configure the device's MTU here using e.g. MTU=9000.
The second config file (ifcfg-br0) defines the bridge device:
# cat > ifcfg-br0 <<EOF
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0
NM_CONTROLLED=no
EOF
WARNING: The line TYPE=Bridge is case-sensitive - it must have uppercase 'B' and lower case 'ridge'
After changing this restart networking (or simply reboot)
# service network restart
Visit for more details
For Xen, this is just a special case of bridged networking.
You create a dummy bridge on your CentOS Dom0, then connect your VM to that bridge.
From the CentOS Documention (http://www.centos.org/docs/5/html/5.2/Virtualization/sect-Virtualization-Virtualized_network_devices-Laptop_network_configuration.html)
create a dummy0 network interface and assign it a static IP address.
In our example I selected 10.1.1.1 to avoid routing problems in our environment. To enable dummy device support add the following lines to /etc/modprobe.conf
alias dummy0 dummy
options dummy numdummies=1
To configure networking for dummy0 edit/create /etc/sysconfig/network-scripts/ifcfg-dummy0:
DEVICE=dummy0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=10.1.1.1
ARP=yes
You can then just connect your VM to the dummy0 bridge device
Additional Reference
http://wiki.xen.org/wiki/HostConfiguration/Networking

Resources