Sometimes we have to configure IP fixed in server and even on workstations.
In this article I will show to configure the IP on Debian and Ubuntu distributions.
Is good idea make backup this configuration before modify.
Use this command
#cp /etc/network/interface /etc/network/interface.bkp
If you want to restore settings
#cp /etc/network/interface.bkp /etc/network/interface
Now you have interface backup.
First check which interface is connected to your network
#ifconfig
eth0 Link encap:Ethernet HWaddr 94:de:80:f3:ca:94
inet addr:192.168.200.2 Bcast:192.168.200.255 Mask:255.255.255.0
inet6 addr: fe80::96de:80ff:fef3:ca94/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:71628 errors:0 dropped:0 overruns:0 frame:0
TX packets:55307 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:47699321 (47.6 MB) TX bytes:7476368 (7.4 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:10114 errors:0 dropped:0 overruns:0 frame:0
TX packets:10114 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:826870 (826.8 KB) TX bytes:826870 (826.8 KB)
As in the example eth0 interface is connected with the IP 192.168.200.2
We most configure this archive /etc/network/interface
Use your favorite text editor, i like to use vi.
#vi /etc/network/interface
now let's edit the last line
auto eth0
iface eth0 inet static
address 192.168.200.100
netmask 255.255.255.0
gateway 192.168.200.1
Save configuration and after run the command
#/etc/init.d/networking restart
Another way to configure the IP is used ifconfig command , but every time the system is booted, IP configuration will not be saved.
#ifconfig eth0 192.168.200.100 netmask 255.255.255.0
After configure your gateway which command:
#route add default gw 192.168.200.1 eth0
sábado, 16 de abril de 2016
Initialize script on startup the system
This article will show you how to start at system startup scripts in Ubuntu and Debian.
First we must create the script in /etc/init.d.
#vi /etc/init.d/myscript.sh
#!/bin/bash
sleep 10 &&
conky &
exit
After creating the script in the /etc/init.d we should give execute permission with the chmod command.
#chmod +x myscript.sh
Now we go using command:
update-rc.d /etc/init.d/myscritp.sh defaults
This exemple will go initialize the conky a software the hardware monitoring. When the system up, the script will initialize with the operational system.
If you want to remove the script from system startup:
First we must create the script in /etc/init.d.
#vi /etc/init.d/myscript.sh
#!/bin/bash
sleep 10 &&
conky &
exit
After creating the script in the /etc/init.d we should give execute permission with the chmod command.
#chmod +x myscript.sh
Now we go using command:
update-rc.d /etc/init.d/myscritp.sh defaults
This exemple will go initialize the conky a software the hardware monitoring. When the system up, the script will initialize with the operational system.
If you want to remove the script from system startup:
- You can delete the script
- Remove permission with the command
- Or remove the boot witch own update-rc.d
Assinar:
Postagens (Atom)