-
-
Save fernandoaleman/2172388 to your computer and use it in GitHub Desktop.
## Configure eth0 | |
# | |
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 | |
DEVICE="eth0" | |
NM_CONTROLLED="yes" | |
ONBOOT=yes | |
HWADDR=A4:BA:DB:37:F1:04 | |
TYPE=Ethernet | |
BOOTPROTO=static | |
NAME="System eth0" | |
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 | |
IPADDR=192.168.1.44 | |
NETMASK=255.255.255.0 | |
## Configure Default Gateway | |
# | |
# vi /etc/sysconfig/network | |
NETWORKING=yes | |
HOSTNAME=centos6 | |
GATEWAY=192.168.1.1 | |
## Restart Network Interface | |
# | |
/etc/init.d/network restart | |
## Configure DNS Server | |
# | |
# vi /etc/resolv.conf | |
nameserver 8.8.8.8 # Replace with your nameserver ip | |
nameserver 192.168.1.1 # Replace with your nameserver ip |
Great!
it's work confirm!!!!
thanks
Wow you don't know how much I did battle with a broken set-up because of bad advice.
Because of this write-up it now works beautifully.
Thank you!
Thanks..
I must say when I started configuring static IP's on Cent OS 7 via CLI it was pretty confusing, but then i understood it - it became much easier. Without need to disable Network Manager, just type this command “nmtui” to open Network manager and edit any connection. This is super easy and no VI , NANO are needed. Plus can reset adapter too. Hope this will help others as well. Regards!
Thanks, It's helpful to me.
How about /etc/hosts file which has reference to server along with alias?
@Azhung I had the same issue but fixed it by adding the line GATEWAY=10.0.1.1
(Replacing with your correct gateway, of course) to /etc/sysconfig/network-scripts/ifcfg-eth0
Can't figure it out. Seems to have a problem setting the IP. I'm trying to set it to 192.168.1.223
$ ping 8.8.8.8
connect: Network is unreachable
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether [snipped] txqueuelen 1000 (Ethernet)
RX packets 23993 bytes 1768614 (1.6MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2243 bytes 634063 (619.2 KiB)
TX errors 0 dropped 0 overrun 0 carrier 0 collisions 0
device interrupt 20 memory 0xf7c00000-f7c20000
lo: [snipped: irrelevant]
Thanks! Lower is better!
Thank you
Thank you. :-)
Thanks!!!!
Muchas gracias - been using this for a long time as reference for static IP. Rock on!
Thank you very much!
thank you..
Thank you so much 👍 :D
For IP ranges you can also use my scirpt: https://github.com/jonsbun/add-ips-centos
@Arinerron: set up your default gateway, no gateway, your systems only knows your local network (192.168.1.x/y). Furthermore you should use ip add sh, instead of ifconfig nowadays.
OMG THANK YOU! Spent half a day trying to figure out how to create a static IP on CentOS.. this took me 5 mins to do.
Make sure to refer to /usr/share/doc/initscripts-*/sysconfig.txt
(search for /etc/sysconfig/network-scripts/ifcfg
) - that's the only built-in documentation for this mechanism.
Okay so dumb question that I probably don't need to worry about, is there a difference when you do ONBOOT=yes versus ONBOOT="yes" with quotes? I get using quotes if there's a space in it like your example of NAME="System eth0" but does it matter for one word entries like yes or no?
I have done all the things as guided but still internet is not working, on using ping command it says unknown hosts: . I did exactly same as asked.please do help me.i tried almost everything.
Thank you so much :)
its nice thank u
thank you :-)
Thanks