Sunday, August 11, 2013

Thiết lập IP tĩnh cho cho centos

1, Để xác định địa chỉ ip và các network interface ta dùng command:
Ifconfig –a
2, Để xem những thiết bị được kết nối vào computer từ IRQ 1 – IRQ 15 :
Cat /proc/interrupts
3, Thiết lập địa chỉ ip tạm thời cho một card mạng eth0 ta dùng command sau :
Ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
4, Cấu hình IP tĩnh cho card mạng eth0 ta tiến hành sửa files /etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BOOTPROTO=static
ONBOOT=yes
BROADCAST=192.168.1.255
NETWORK=192.168.1.0
Sau khi cấu hình xong tiến hành save lại và khởi động card mạng để nhận địa chỉ ip mới.
service network restart
5, Cấu hình nhiều ip cho một card mạng (card mạng ảo) : tạo một files ifcfg-eth0:1 có nội dung như sau :
DEVICE=eth0:1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.99
NETMASK=255.255.255.0
Để card mạng ảo này ta cần phải dùng
service network restart
6, Cấu hình gán hostname cho Centos .Chỉnh sửa files /etc/hosts với nội dung như sau
127.0.0.0 localhost qhoa.com
7, Cấu hình định tuyến tĩnh (static route) :
Cấu hình thiết lập địa chỉ gateway mặc định
route add default gw 192.168.1.1
Tạo một tuyến đường đi tới mạng 10.0.0.0/24 qua gateway 192.168.1.254
route add 10.0.0.0 netmask 255.255.255.0 gw 192.168.1.254 eth0
8, Cấu hình DNS client cho centos . Ta tiến hành chỉnh sửa files /etc/resolv.conf
nameserver 8.8.8.8
nameserver 208.67.222.222
nameserver 208.67.220.220

Related Posts:

  • Setup mysql server 1.Add permission to tmp folder.  chown root:root /tmp   107  chmod 1777 /tmp 2.Video guide: 3.Command install sudo yum install mysql-server service mysqld start sudo /usr/bin/mysql_secure_installation Open po… Read More
  • Monitoring Users Activity Using Psacct Or Acct Tools In Linux  If you have lot of developers or programmers who access your servers frequently in your company and if you wanna to keep an eye on what data they are accessing, what commands they are issuing, how long they have been ac… Read More
  • dos2unix NAME dos2unix - DOS/MAC to UNIX text file format converter SYNOPSYS dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRI… Read More
  • SSH Tutorial SSH (Secure Shell) là một giao thức mạng dùng để thiết lập kết nối mạng một cách bảo mật. SSH hoạt động ở lớp trên trong mô hình phân lớp TCP/IP. Các công cụ SSH (như là OpenSSH, …) cung cấp cho người dùng cách thứ… Read More
  • Midnight Commander Midnight Commander is a console file manager and directory browser. It is a friendly system for many tasks in the terminal window, and the quickest way to copy, move or delete multiple files. MC can also do fast ftp and netw… Read More