Převzato z různých webů :
$ ip route show 192.168.91.0/24 dev eth0 proto kernel scope link src 192.168.91.128 169.254.0.0/16 dev eth0 scope link metric 1002 default via 192.168.91.2 dev eth0
In order to change a default gateway to another IP address:
$ sudo ip route replace default via 192.168.91.10 dev eth0
In order to set a default gateway permanently on CentOS, you will need to update /etc/sysconfig/network accordingly.
$ sudo vi /etc/sysconfig/network
GATEWAY=192.168.91.10
Again, be aware that the IP addressed specified here should match with the subnet (192.168.91.0/24) associated with a default route interface.
Another option to set a default gateway persistently on CentOS is to edit /etc/sysconfig/network-scripts/ifcfg-<default_interface_name>, and add “GATEWAY=<gateway_ip>” there. If the default interface is “eth0″, you will need to edit /etc/sysconfig/network-scripts/ifcfg-eth0. If you choose to use this method, you need to refer to this post to get familiar with this option.
Whether you edit /etc/sysconfig/network or /etc/sysconfig/network-scripts/ifcfg-ethX, don’t forget to restart network service as follows, or reboot your CentOS for the change to take effect.
$ sudo service network restart
Na CentOSu stačí nainstalovat: bind
, caching-nameserver
(yum install
), upravit soubor /etc/resolv.conf
a nastartovat named (service named start
).
Test:
dig domena.cz
;; Query time: 130 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jun 28 12:02:32 2008
;; MSG SIZE rcvd: 165
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jun 28 12:02:32 2008
;; MSG SIZE rcvd: 165
Upravit - nameserver 127.0.0.1 - v resolv.conf
Jak ručně nastavit ip adresu přes dhcp -
dhclient eth0
Jeden z příkazů :
system-config-network
Install shorewall on CentOS or RHEL
First, turn on EPEL repo and type the following yum command to install shorewall package:
# yum install shorewall
Pokud nenajde yum shorewall –
If you are running an CentOS6/EL6 version, enter:
$ cd /tmp $ wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm # rpm -ivh epel-release-6-8.noarch.rpm
If you are running an CentOS5/EL5 version, enter:
$ cd /tmp $ wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm # rpm -ivh epel-release-5-4.noarch.rpm
If you are running an CentOS4/EL4 version, enter:
The following may not be supported:
$ cd /tmp $ wget http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm # rpm -ivh epel-release-4-10.noarch.rpm
Install epel*.rpm file using yum command
You can use the yum command instead of rpm command:
# yum install epel-release-6-8.noarch.rpm
Test na správnou funkci :
arp -a -n|grep 22.254
If you see something like
? (192.168.22.254) at 00:c0:f0:3b:4d:eb [ether] on eth0
then it’s up and available, even if it’s filtering ICMP echo-requests (ping requests).
If you get
? (192.168.22.254) at <incomplete> on eth0
then it’s genuinely down.
Jak nastavit default gateway :
ip route add default via 192.168.99.254 dev eth0