static ip after boot

Started by Lukas Mistr, December 05, 2014, 04:12:49 PM

Previous topic - Next topic

Lukas Mistr

Hello,

I do not know how to set a static IP address after booting. I read the user guide, but I could not make it work. I got stuck in point:
vi /etc/network.d/my_eth_network
configure all parameters (make sure you change eth0 to usb0)

could you give me some advice?

MBR

In Debian, the main configuration file is /etc/network/interfaces and for static IP, it must look like this example (the device has IP 192.168.1.2 an the router/gateway 192.168.1.1):


allow-hotplug eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1


hylas

What system are you running? Official SD-card image?

Lukas Mistr

used the official SD-card image - Arch Linux 2.6.35-8-ARCH +.

I tried the code from the MBR and here I got the answer:


[root@alarm ~]# vi /etc/network.d/my_eth_network
CONNECTION='ethernet'
DESCRIPTION='A basic dhcp ethernet connection using iproute'
INTERFACE='usb0'
IP='static'
        address 192.168.1.2
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

## for DHCPv6
#IP6='dhcp'
## for IPv6 autoconfiguration
#IP6='stateless'

~
~
~
"/etc/network.d/my_eth_network" 15 lines, 298 characters
[root@alarm ~]# netcfg my_eth_network
/etc/network.d/my_eth_network: line 5: address: command not found
/etc/network.d/my_eth_network: line 6: netmask: command not found
/etc/network.d/my_eth_network: line 7: network: command not found
/etc/network.d/my_eth_network: line 8: broadcast: command not found
/etc/network.d/my_eth_network: line 9: gateway: command not found
/etc/network.d/my_eth_network: line 5: address: command not found
/etc/network.d/my_eth_network: line 6: netmask: command not found
/etc/network.d/my_eth_network: line 7: network: command not found
/etc/network.d/my_eth_network: line 8: broadcast: command not found
/etc/network.d/my_eth_network: line 9: gateway: command not found
:: my_eth_network up                                                     [BUSY]
/etc/network.d/my_eth_network: line 5: address: command not found
/etc/network.d/my_eth_network: line 6: netmask: command not found
/etc/network.d/my_eth_network: line 7: network: command not found
/etc/network.d/my_eth_network: line 8: broadcast: command not found
/etc/network.d/my_eth_network: line 9: gateway: command not found
/etc/network.d/my_eth_network: line 5: address: command not found
/etc/network.d/my_eth_network: line 6: netmask: command not found
/etc/network.d/my_eth_network: line 7: network: command not found
/etc/network.d/my_eth_network: line 8: broadcast: command not found
/etc/network.d/my_eth_network: line 9: gateway: command not found
/etc/network.d/my_eth_network: line 5: address: command not found
/etc/network.d/my_eth_network: line 6: netmask: command not found
/etc/network.d/my_eth_network: line 7: network: command not found
/etc/network.d/my_eth_network: line 8: broadcast: command not found
/etc/network.d/my_eth_network: line 9: gateway: command not found
                                                                         [DONE]

hylas

Take a look in the file /etc/rc.conf. There are commented out examples of both static ip and dhcp. I haven't tried dhcp but the static method worked ok when I tested it.

A word of caution. This image is far out of date and can't be used with the current repositories for Archlinuxarm.

Best of luck.

/Magnus

Lukas Mistr

Thank you for your help. I had to use

address=192.168.1.2
netmask=255.255.255.0
network=192.168.1.0
broadcast=192.168.1.255
gateway=192.168.1.1