Fedora Linux Support Community & Resources Center
  #1  
Old 14th June 2012, 05:06 PM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
linuxfirefox
Kernel dummy module

Hi,

I would like to use the dummy module to create a fake ethernet interface with a name and HWaddr of my choosing that is present on every boot. What is the best way of achieving this?

I know modprobe dummy will load the kernel module and create a dummy0 interface, but how do I rename it and set its HWaddr? I would like to know how to perform these tasks in a fashion that is persistent across reboots.

Kind regards,

Yax
Reply With Quote
  #2  
Old 14th June 2012, 11:06 PM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfirefox
Re: Kernel dummy module

You can set it up just like a "normal" ethernet interface

modprobe and set up network address of dummy interface:
Code:
[root@tower20 etc]# modprobe dummy
[root@tower20 etc]# ifconfig dummy0 192.168.2.10
add routing, check network binding and route commands:
Code:
[root@tower20 etc]# route add 192.168.2.10 dummy0
[root@tower20 etc]# ifconfig dummy0
dummy0: flags=195<UP,BROADCAST,RUNNING,NOARP>  mtu 1500
        inet 192.168.2.10  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::6c21:16ff:feac:cc09  prefixlen 64  scopeid 0x20<link>
        ether 6e:21:16:ac:cc:09  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3  bytes 210 (210.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@tower20 etc]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         dslrouter       0.0.0.0         UG    0      0        0 p33p2
192.168.1.0     *               255.255.255.0   U     0      0        0 p33p2
192.168.2.0     *               255.255.255.0   U     0      0        0 dummy0
tower20.home    *               255.255.255.255 UH    0      0        0 dummy0
You would probably also wish to add the address to your /etc/hosts file as well.
Reply With Quote
  #3  
Old 14th June 2012, 11:20 PM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
windows_7firefox
Re: Kernel dummy module

Cheers for the response, but principally I want to know how to rename the interface and fix its HWaddr

Code:
[root@myhost ~]# modprobe dummy; ifconfig -a | grep dummy0; rmmod dummy
dummy0    Link encap:Ethernet  HWaddr 26:3E:8D:8D:9D:AC
[root@myhost ~]# modprobe dummy; ifconfig -a | grep dummy0; rmmod dummy
dummy0    Link encap:Ethernet  HWaddr 82:15:35:6C:7C:F1
[root@myhost ~]# modprobe dummy; ifconfig -a | grep dummy0; rmmod dummy
dummy0    Link encap:Ethernet  HWaddr 26:7A:77:57:A7:7C
[root@myhost ~]# modprobe dummy; ifconfig -a | grep dummy0; rmmod dummy
dummy0    Link encap:Ethernet  HWaddr FE:AD:E2:B8:8F:43
[root@myhost ~]# modprobe dummy; ifconfig -a | grep dummy0; rmmod dummy
dummy0    Link encap:Ethernet  HWaddr A6:AB:66:C1:79:85
[root@myhost ~]# modprobe dummy; ifconfig -a | grep dummy0; rmmod dummy
dummy0    Link encap:Ethernet  HWaddr BE:FC:14:74:DD:EA
[root@myhost ~]#
I need a fixed HWaddr for it, and I need it to appear as a real ethernet via its name, i.e I want to rename it to eth0.

Cheers,

Yax
Reply With Quote
  #4  
Old 15th June 2012, 12:33 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,781
linuxfirefox
Re: Kernel dummy module

Umm.. Why do you need it to have the same hardware address?

The TCP/IP packets get the mac address of the last network interface. In the case of the dummy interfaces that should be the hardware MAC address of the p33p2 interface (as seen from your routing table).
Reply With Quote
  #5  
Old 15th June 2012, 11:04 AM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
linuxfirefox
Re: Kernel dummy module

Quote:
Originally Posted by jpollard View Post
Umm.. Why do you need it to have the same hardware address?

The TCP/IP packets get the mac address of the last network interface. In the case of the dummy interfaces that should be the hardware MAC address of the p33p2 interface (as seen from your routing table).
TCP/IP packets don't get any MAC address (unless the application specifically puts this into the TCP payload). Ethernet frames which may (or may not) encapsulate TCP/IP packets will have MAC addresses in the frame header.

I want the dummy interface to behave like a real ethernet interface. What ethernet card do you have that changes its MAC address every time the driver is loaded into the kernel?

How can I request this thread to be moved to the networking forum?

Cheers

Yax
Reply With Quote
  #6  
Old 15th June 2012, 02:27 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,781
linuxfirefox
Re: Kernel dummy module

You can always try the ethtool utility to set the mac address. I'm not sure it will work with the dummy driver though.

As far as I know, any dummy ethernet device gets a random MAC address simply because it is required as part of the ethernet protocol. The MAC address is useless for anything but DHCP.
Reply With Quote
  #7  
Old 15th June 2012, 05:24 PM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
linuxchrome
Re: Kernel dummy module

I've managed to do it by using ifrename and macchanger, but I was hoping to avoid adding stuff to rc.local ... unless I can find a way to do this persistently I don't have much choice
Reply With Quote
  #8  
Old 15th June 2012, 05:37 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,781
linuxfirefox
Re: Kernel dummy module

Note: doing it in rc.local will not start network services properly. Things like NFS can fail as they depend on the network, but are only signaled by the systemd event handling...
Reply With Quote
  #9  
Old 15th June 2012, 06:14 PM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
linuxchrome
Re: Kernel dummy module

Cheers for the tip. Fortunately, nothing explicitly depends on this interface.
Reply With Quote
Reply

Tags
dummy, kernel, module

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Write Linux kernel module to collect data from the kernel rcbandit Programming & Packaging 2 13th September 2011 10:44 AM
Akmods not finding kernel source (& Kernel Module size too large in Custom Compile) jbkt23 Using Fedora 27 18th July 2009 12:05 AM


Current GMT-time: 08:19 (Monday, 28-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat