cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gtsasha
Visitor
Visitor
7,218 Views
Registered: ‎02-06-2015

IPv4 auto-configuration

Hello!

 

I am trying to setup network communications on a custom board running PetaLinux.  I want my network interface to aquire an IPv4 address or IPv4 auto-configuration address if DHCP server is not available.

 

I placed the following command into my startup script:

 

udhcpc -i usb0 -n

 

usb0 is the only network interafce on my board.  When I execute ifconfig command to see the setup I see the following:

 

usb0 Link encap:Ethernet HWaddr 56:7e:ac:ce:49:ab
     inet6 addr: fe80::547e:acff:fece:49ab/64 Scope:Link
     UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
     RX packets:1250 errors:0 dropped:0 overruns:0 frame:0
     TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:146370 (142.9 KiB) TX bytes:9920 (9.6 KiB)

 

The interface has an IPv6 auto-configuration (link-local) address, but not IPv4.  Is there a way to force it to aquire IPv4 link-local address (169.254.XX.XX)?

 

Also, is there any way to control the contents of /etc/network/interfaces file?

 

It lists a number of interaces I don't have on my board such as wlan0, eth0, and bnep0.  For usb0 it specifies static IPv4 configuration:

 

# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet static
    address 192.168.7.2
    netmask 255.255.255.0
    network 192.168.7.0
    gateway 192.168.7.1

 

The interface usb0 does not come up with these values so I am not sure how they are used and where they come from.  Is there a way to control what goes into /etc/network/interfaces file?

 

Thank you.

 

 

0 Kudos
0 Replies