Difference between revisions of "Fix network configuration"

From ElphelWiki
Jump to: navigation, search
(Quick instructions)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Description==
 
==Description==
In the firmware [https://community.elphel.com/files/393/20180511/ '''20180511'''] (and older) the ip address and network mask of the camera are set by ''/etc/elphel393/init_elphel393.py''
+
In the firmware [https://community.elphel.com/files/393/20180511/ '''20180511'''] (and older) the ip address and network mask of the camera are set by '''''/etc/elphel393/init_elphel393.py'''''
script overriding ''/etc/network/interfaces'', which appeared to have incorrect configuration.
+
script overriding '''''/etc/network/interfaces''''', which appeared to have incorrect configuration.
 +
 
 +
In the newer firmware releases this functionality will be disabled to bring the network setup to a more traditional way, i.e. by modifying '''''/etc/network/interfaces'''''.  
  
In the newer firmware releases this functionality will be disabled to bring the network setup to a more traditional way, i.e. by modifying ''/etc/network/interfaces''.
 
 
Follow the instructions below to fix this for the older firmware.
 
Follow the instructions below to fix this for the older firmware.
  
 
==How to update network setup for '''20180511''' (or older firmware)==
 
==How to update network setup for '''20180511''' (or older firmware)==
 
===Quick instructions===
 
===Quick instructions===
* Camera is online. The ip address can be any, e.g., 192.168.0.9
+
* Camera is online. The IP address can be any, e.g., 192.168.0.9
* PC: in a terminal window (linux os) type the following commands:
+
* PC: in a terminal window (GNU/Linux OS) type the following commands:
 
  <font size='2'>wget https://community.elphel.com/files/393/fix_network_config/fix_net_config.tar.gz
 
  <font size='2'>wget https://community.elphel.com/files/393/fix_network_config/fix_net_config.tar.gz
 
  tar -xzpf fix_net_config.tar.gz
 
  tar -xzpf fix_net_config.tar.gz
 
  cd fix_net_config
 
  cd fix_net_config
 
  ./host_script.sh 192.168.0.9</font>
 
  ./host_script.sh 192.168.0.9</font>
 +
Example output:
 +
<font size='1'>Copy data to the target...
 +
rootfs.tar.gz                                                                                                                                                                                                                             
 +
100%  925    0.9KB/s  00:00   
 +
fix_net_config.py                                                                                                                                                                                                                         
 +
100% 2701    2.6KB/s  00:00   
 +
Run fix_net_config.py from the target...
 +
Step 0: Start
 +
Step 1: Unpack
 +
Step 2: Read current network settings
 +
Settings for /etc/network/interfaces:
 +
  ipaddr:  192.168.0.9
 +
  netmask: 255.255.255.0
 +
  gateway: 192.168.0.15
 +
Step 3: Apply network settings to file
 +
Step 4: Overwrite filesystem
 +
Step 5: Request syncing (if boot from flash)
 +
NEXT:
 +
    * if boot from SD card - simply reboot
 +
    * if boot from flash -
 +
      ~$ ssh root@192.168.0.9
 +
      root@elphel393:~# shutdown -hP now
 +
      then powercycle
 +
Success</font>
 +
 +
* To sync the changes to the file system:
 +
<font size=2>ssh root@192.168.0.9
 +
''pass''</font>
 +
 +
<font size=2>#boot from NAND flash?
 +
root@elphel393:~# shutdown -hP now
 +
#powercycle</font>
 +
 +
<font size=2>#boot from card?
 +
root@elphel393:~# sync
 +
root@elphel393:~# reboot -f</font>
 +
 +
Next, any extra changes related to setting ip address, netmask or gateway made to '''''/etc/elphel393/init_elphel393.py''''' can be commented out or the original file can be used.
  
 
===Description===
 
===Description===
 
From a Linux PC, download [https://community.elphel.com/files/393/fix_network_config/fix_net_config.tar.gz fix_net_config.tar.gz].
 
From a Linux PC, download [https://community.elphel.com/files/393/fix_network_config/fix_net_config.tar.gz fix_net_config.tar.gz].
 
The archive contains 2 scripts - one (shell) is run from the host PC, another (python) will be copied and automatically run on the camera.  
 
The archive contains 2 scripts - one (shell) is run from the host PC, another (python) will be copied and automatically run on the camera.  
The python script will write the current configuration to ''/etc/network/interfaces'' and overwrite one of the init scripts to disable network
+
The python script will write the current configuration (IP, mask, default gateway for eth0) to '''''/etc/network/interfaces''''' and overwrite one of the init scripts to disable network
configuration in ''/etc/elphel393/init_elphel393.py'' on startup.
+
configuration in '''''/etc/elphel393/init_elphel393.py''''' on startup.
 
  <font size='2'>'''fix_net_config.tar.gz'''
 
  <font size='2'>'''fix_net_config.tar.gz'''
 
  ├── '''README.md'''         
 
  ├── '''README.md'''         
Line 25: Line 64:
 
  ├── '''fix_net_config.py'''            - unpacks '''rootfs.tar.gz''', replaces network configuration with the current one and copies all files to the root file system
 
  ├── '''fix_net_config.py'''            - unpacks '''rootfs.tar.gz''', replaces network configuration with the current one and copies all files to the root file system
 
  └── '''rootfs.tar.gz'''                - archive with 2 files
 
  └── '''rootfs.tar.gz'''                - archive with 2 files
     ├──'''etc/init.d/init_elphel393''' - init script that disables network setup in ''/etc/elphel393/init_elphel393.py''
+
     ├──'''etc/init.d/init_elphel393''' - init script that disables network setup in '''''/etc/elphel393/init_elphel393.py'''''
 
     └──'''etc/network/interfaces'''    - network setup for eth0
 
     └──'''etc/network/interfaces'''    - network setup for eth0
 
</font>
 
</font>
 
 
  
 
[[Category:393]]
 
[[Category:393]]

Latest revision as of 14:51, 26 October 2018

Description

In the firmware 20180511 (and older) the ip address and network mask of the camera are set by /etc/elphel393/init_elphel393.py script overriding /etc/network/interfaces, which appeared to have incorrect configuration.

In the newer firmware releases this functionality will be disabled to bring the network setup to a more traditional way, i.e. by modifying /etc/network/interfaces.

Follow the instructions below to fix this for the older firmware.

How to update network setup for 20180511 (or older firmware)

Quick instructions

  • Camera is online. The IP address can be any, e.g., 192.168.0.9
  • PC: in a terminal window (GNU/Linux OS) type the following commands:
wget https://community.elphel.com/files/393/fix_network_config/fix_net_config.tar.gz
tar -xzpf fix_net_config.tar.gz
cd fix_net_config
./host_script.sh 192.168.0.9

Example output:

Copy data to the target...
rootfs.tar.gz                                                                                                                                                                                                                               
100%  925     0.9KB/s   00:00    
fix_net_config.py                                                                                                                                                                                                                           
100% 2701     2.6KB/s   00:00    
Run fix_net_config.py from the target...
Step 0: Start
Step 1: Unpack
Step 2: Read current network settings
Settings for /etc/network/interfaces:
  ipaddr:  192.168.0.9
  netmask: 255.255.255.0
  gateway: 192.168.0.15
Step 3: Apply network settings to file
Step 4: Overwrite filesystem
Step 5: Request syncing (if boot from flash)
NEXT:
    * if boot from SD card - simply reboot
    * if boot from flash -
      ~$ ssh root@192.168.0.9
      root@elphel393:~# shutdown -hP now
      then powercycle
Success
  • To sync the changes to the file system:
ssh root@192.168.0.9
pass
#boot from NAND flash?
root@elphel393:~# shutdown -hP now
#powercycle
#boot from card?
root@elphel393:~# sync
root@elphel393:~# reboot -f

Next, any extra changes related to setting ip address, netmask or gateway made to /etc/elphel393/init_elphel393.py can be commented out or the original file can be used.

Description

From a Linux PC, download fix_net_config.tar.gz. The archive contains 2 scripts - one (shell) is run from the host PC, another (python) will be copied and automatically run on the camera. The python script will write the current configuration (IP, mask, default gateway for eth0) to /etc/network/interfaces and overwrite one of the init scripts to disable network configuration in /etc/elphel393/init_elphel393.py on startup.

fix_net_config.tar.gz
├── README.md         
├── host_script.sh               - run from host pc: copies fix_net_config.py and rootfs.tar.gz then runs fix_net_config.py
├── fix_net_config.py            - unpacks rootfs.tar.gz, replaces network configuration with the current one and copies all files to the root file system
└── rootfs.tar.gz                - archive with 2 files
    ├──etc/init.d/init_elphel393 - init script that disables network setup in /etc/elphel393/init_elphel393.py
    └──etc/network/interfaces    - network setup for eth0