LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Centos 6.2 set static IP (http://www.linuxquestions.org/questions/linux-server-73/centos-6-2-set-static-ip-931188/)

velvetbulldozer 02-25-2012 05:43 AM

Centos 6.2 set static IP
 
Hi folks,
I am continuing with the learning in my Linux Lab. So far I have done the following:
- Installed Centos 6.2
- Configured Samba both via command line and Swat (that was tricky)
- Built a Raid 5 array + Lvm
- Set up shared directories
- Installed a dlna server (tvmobili) all tvs see the Linux server
Next step is to allow the Macs in the house to gain acces to the linux. Anyone knows how to do that...?
I wanted to ask you which of these files is the one to set a static ip(os centos 6.2):

-rw-r--r--. 1 root root 254 Oct 7 17:01 ifcfg-lo
lrwxrwxrwx. 1 root root 20 Dec 16 07:09 ifdown -> ../../../sbin/ifdown
-rwxr-xr-x. 1 root root 627 Oct 7 17:01 ifdown-bnep
-rwxr-xr-x. 1 root root 5569 Oct 7 17:01 ifdown-eth
-rwxr-xr-x. 1 root root 781 Oct 7 17:01 ifdown-ippp
-rwxr-xr-x. 1 root root 4168 Oct 7 17:01 ifdown-ipv6
lrwxrwxrwx. 1 root root 11 Dec 16 07:09 ifdown-isdn -> ifdown-ippp
-rwxr-xr-x. 1 root root 1481 Oct 7 17:01 ifdown-post
-rwxr-xr-x. 1 root root 1064 Oct 7 17:01 ifdown-ppp
-rwxr-xr-x. 1 root root 651 Oct 7 17:01 ifdown-routes
-rwxr-xr-x. 1 root root 1370 Oct 7 17:01 ifdown-sit
-rwxr-xr-x. 1 root root 1434 Oct 7 17:01 ifdown-tunnel
lrwxrwxrwx. 1 root root 18 Dec 16 07:09 ifup -> ../../../sbin/ifup
-rwxr-xr-x. 1 root root 13445 Oct 7 17:01 ifup-aliases
-rwxr-xr-x. 1 root root 859 Oct 7 17:01 ifup-bnep
-rwxr-xr-x. 1 root root 10456 Oct 7 17:01 ifup-eth
-rwxr-xr-x. 1 root root 11971 Oct 7 17:01 ifup-ippp
-rwxr-xr-x. 1 root root 10683 Oct 7 17:01 ifup-ipv6
lrwxrwxrwx. 1 root root 9 Dec 16 07:09 ifup-isdn -> ifup-ippp
-rwxr-xr-x. 1 root root 727 Oct 7 17:01 ifup-plip
-rwxr-xr-x. 1 root root 954 Oct 7 17:01 ifup-plusb
-rwxr-xr-x. 1 root root 2364 Oct 7 17:01 ifup-post
-rwxr-xr-x. 1 root root 4154 Oct 7 17:01 ifup-ppp
-rwxr-xr-x. 1 root root 1712 Oct 7 17:01 ifup-routes
-rwxr-xr-x. 1 root root 3499 Oct 7 17:01 ifup-sit
-rwxr-xr-x. 1 root root 2488 Oct 7 17:01 ifup-tunnel
-rwxr-xr-x. 1 root root 3770 Oct 7 17:01 ifup-wireless
-rwxr-xr-x. 1 root root 4623 Oct 7 17:01 init.ipv6-global
-rwxr-xr-x. 1 root root 1125 Oct 7 17:01 net.hotplug
-rw-r--r--. 1 root root 11736 Oct 7 17:01 network-functions
-rw-r--r--. 1 root root 29853 Oct 7 17:01 network-functions-ipv6

Thanks,
Dan

acid_kewpie 02-25-2012 06:48 AM

none of those files are relevant. Settings for your first ethernet nic would be in /etc/sysconfig/network-scripts/ifcfg-eth0 you can use the system-config-network tool to manage it. If you have Network Manager running, I would suggest you disable it, as it will cause conflist between the conventional way to manage server addresses.

velvetbulldozer 02-25-2012 06:13 PM

no such file....
 
Thanks Chris, but I have no such file in that particular directory. The system-config-network tool gave no choices of configuration; it was empty so to speak.
Perhaps in centos 6.2 they placed that info somewhere else.
Dan

Quote:

Originally Posted by acid_kewpie (Post 4611638)
none of those files are relevant. Settings for your first ethernet nic would be in /etc/sysconfig/network-scripts/ifcfg-eth0 you can use the system-config-network tool to manage it. If you have Network Manager running, I would suggest you disable it, as it will cause conflist between the conventional way to manage server addresses.


acid_kewpie 02-25-2012 06:15 PM

do you have a network connection in the first place? It seems very odd to be doing this AFTER configuring SaMBa...? what does "ifconfig -a" say? No eth0 listed there says there's no valid driver or no hardware found.

vp0619520 02-25-2012 11:09 PM

Hi,I use the same system,but I found the file /etc/sysconfig/network-scripts/ifcfg-eth0.I think you can use the command:'ifconfig -a',and check the output ,I think you just have not install the driver of your NIC correctly.

velvetbulldozer 02-26-2012 06:20 AM

more....
 
Hi, the network is working fine and the drivers are installed. I configured samba with the 104 ip given by the dhcp but now i want to set it static. In the /etc/sysconfig/network-scripts/ directory there is a file called ifcfg-lo. See the contents below, but I think this one refers to the localhost.

DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback

This is the contents of ifconfig -a:

eth0 Link encap:Ethernet HWaddr 00:24:BE:BC:1D:1A
inet addr:192.168.100.104 Bcast:192.168.100.255 Mask:255.255.255.0
inet6 addr: fe80::224:beff:febc:1d1a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:584078934 errors:0 dropped:2519095 overruns:0 frame:0
TX packets:269580947 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:712243443428 (663.3 GiB) TX bytes:355112425508 (330.7 GiB)
Interrupt:18

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:16436 Metric:1
RX packets:593700 errors:0 dropped:0 overruns:0 frame:0
TX packets:593700 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:113487887 (108.2 MiB) TX bytes:113487887 (108.2 MiB)

wlan0 Link encap:Ethernet HWaddr 00:23:14:23:31:8C
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

[root@linux network-scripts]#



Quote:

Originally Posted by vp0619520 (Post 4612105)
Hi,I use the same system,but I found the file /etc/sysconfig/network-scripts/ifcfg-eth0.I think you can use the command:'ifconfig -a',and check the output ,I think you just have not install the driver of your NIC correctly.


vp0619520 02-26-2012 08:32 AM

I see.I think you can build a file named ifcfg-eth0 in that directory.And add the following statement:
Code:

      DEVICE=eth0
      IPADDR='youraddr'
      NETMASK='yournetmask'
      NETWORK='yournetwork'
      ONBOOT=yes

Save it.Then,use the command
Code:

# service network restart
,and see the output.I think that will enable the eth0.You can also reboot your computer to check whether it is working correctly.


All times are GMT -5. The time now is 05:31 PM.