Setari IP, Subnet Mask, DNS, Gateway pentru acces internet LINUX, din linie de comanda. Cum faci sa se pastreze ip-urile dupa restart (reboot)

Placa de retea in sistem pentru care facem modificarile are denumirea eth0 si o vom configura cu urmatoarele setari:

IP address: 192.168.1.2
Subnet Mask: 255.255.255.0
Gateway:192.168.1.254

DNS1: 192.168.1.253
DNS2:192.168.1.252

Pentru a aplica IP-urile de mai sus scrie comanda urmatoare inlocuind unde este necesar:


ifconfig eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.0.255 up
route add default gw 192.168.1.254
echo "nameserver 192.168.1.253" > /etc/resolv.conf
echo "nameserver 192.168.1.252" >> /etc/resolv.conf

Dupa repornirea masinii va trebui sa rulam comenzile de mai sus.

Pentru salvarea setarilor IP dupa reboot trebuie modificate anumite fisiere de sistem:

REDHAT/FEDORA

/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=nume_PC
GATEWAY="192.168.1.254"

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes

Vezi si alte tutoriale

[ad name=”v1″]

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

©2024 KLEO Template a premium and multipurpose theme from Seventh Queen

Log in with your credentials

Forgot your details?