Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dhcp server AND client at the same time #3

Open
hh opened this issue Nov 5, 2015 · 3 comments
Open

dhcp server AND client at the same time #3

hh opened this issue Nov 5, 2015 · 3 comments

Comments

@hh
Copy link
Member

hh commented Nov 5, 2015

I wonder if it's possible to use dhcpclient and dhcpserver on same interface.

Since it's USB (only one other host), doing both should be feasible. (in case it's our internet connection, or in case they don't know they can share and we need them to reach our 1.1.1.1 address)

(internet sharing from host to iigagdet)
(iigadget supporting plug and play)

@hh
Copy link
Member Author

hh commented Nov 7, 2015

http://www.linux-usb.org/gadget/

# manufacturing assigns Ethernet addresses; company id is xx:xx:xx
setenv eth_a_host    xx:xx:xx:01:23:45
setenv eth_a_gadget  xx:xx:xx:67:89:ac
setenv eth_i_vendor  "Great Stuff, LLC"
setenv eth_i_product "Our Cool Thing"
setenv eth_args             g_ether.host_addr=\$(eth_a_host)
setenv eth_args $(eth_args) g_ether.dev_addr=\$(eth_a_gadget)
setenv eth_args $(eth_args) g_ether.iManufacturer=\$(eth_i_vendor)
setenv eth_args $(eth_args) g_ether.iProduct=\$(eth_i_product)
# you can assign USB vendor/product/version codes too...
setenv add_eth_args setenv bootargs $(eth_args) \$(bootargs)
...
setenv bootcmd run add_eth_args\;bootm

For production devices, maybe look into http://standards.ieee.org/faqs/regauth.html

@hh
Copy link
Member Author

hh commented Nov 7, 2015

http://www.electronic-products-design.com/resources/customer-guides/manufacturing/obtaining-mac-addresses-for-product-with-an-ethernet-interface

Look like the smallest block of mac addresses is $550 for 4096, and then $1650/16777214

@hh
Copy link
Member Author

hh commented Nov 7, 2015

Unique hostname on boot:

jimmyken793/boot-scripts@ebe2880

    if [ `cat /etc/hostname` = arm ] ; then
        hostname=ky-controller-$(hexdump -v -e '1/1 "%02X" ' /proc/device-tree/ocp/ethernet@4a100000/slave@4a100200/mac-address)
        echo $hostname > /etc/hostname 
        hostname $hostname
        echo -e "127.0.0.1\t$hostname" |sudo tee -a /etc/hosts
    fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant