Solved

config Ip address , subnet ,defult gateway, DNS server manully

Posted on 2006-07-12
26
6,600 Views
Last Modified: 2008-01-09
how to config Ip address , subnet ,defult gateway, DNS server manully in linux
0
Comment
Question by:llvllar1on
  • 12
  • 6
  • 4
  • +2
26 Comments
 
LVL 24

Assisted Solution

by:slyong
slyong earned 200 total points
Comment Utility
I am on Fedora Core 4, the configuration file is in:
/etc/sysconfig/network-scripts/ifcfg-eth0
for IP address, subnet, netmask.

/etc/sysconfig/network
for gateway

/etc/resolv.conf
for DNS servers

after changing the file, do:

# service network restart
0
 
LVL 14

Assisted Solution

by:ppfoong
ppfoong earned 50 total points
Comment Utility

If you are using Mandriva, can use the command "drakconf".

If you are using Redhat, can use the command "netconfig".

0
 

Author Comment

by:llvllar1on
Comment Utility
how about suse and gentoo.....   i am using those two
0
 
LVL 39

Assisted Solution

by:noci
noci earned 150 total points
Comment Utility
Gentoo:

This file does the trick: /etc/conf.d/net
I think the comments tell it all

If you need an f.e. eth0 to configure
then you also need:

ln -s net.lo /etc/init.d/net.eth0
rc-update add net.eth0


In Suse there is config tool too I think it is called yast
0
 

Author Comment

by:llvllar1on
Comment Utility
any command in suse i can use..............
0
 
LVL 39

Expert Comment

by:noci
Comment Utility
yast

is the Yet Another Setup Tool.... ;-)
0
 

Author Comment

by:llvllar1on
Comment Utility
/etc/sysconfig/network/ifcfg-* . here is the place to change ip setting in suse, but i dont know how to active setting after set excluding reboot.
0
 
LVL 39

Assisted Solution

by:noci
noci earned 150 total points
Comment Utility
/etc/init.d/<networking or net??> restart
should work...


like in gentoo: '/etc/init.d/net.eth0 start' does the trick withou reboot.
0
 
LVL 1

Assisted Solution

by:antoxa
antoxa earned 100 total points
Comment Utility
you can configure it for current session and this settings will be lost after reboot
for example

ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

WBR
0
 

Author Comment

by:llvllar1on
Comment Utility
i used vi /etc/sysconfig/network/ifcfg-*. but i dont really know how to modified.
i also tried
ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

and them i typed network restart .  it didnot work either . need help for suse network setting
0
 
LVL 1

Assisted Solution

by:antoxa
antoxa earned 100 total points
Comment Utility
after

ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

you don't need to do network restart

because network starting scripts doing the same, but with you static options

for manual changes you must know about your network settings
you must know your IP address (in example 192.168.0.100), your netmask (in example 255.255.255.0), broadcast can be calculated from IP address and netmask, but for 192.168.0.100/255.255.255.0 it will be 192.168.0.255, and you must know your DNS servers, for typing it in /etc/resolv.conf
could you try to configure it with your settings and show results
after 'ifconfig bla-bla' you can check your settings by typing 'ifconfig', you will see your network interfaces
after 'route add default bla-bla' you can check your routing table by typing 'route -vn', you will see your default router
after that you can check you network link by pinging your router 'ping IPaddress'
and if pings resulats is OK, you will configure /etc/resolv.conf


0
 
LVL 39

Expert Comment

by:noci
Comment Utility
In the ifcfg-* files there are variables...

NAME=Value

Like:

NETMASK=...
IP=...
GATEWAY=...

These need to be filled out.

Before you just add values, what is the ip address of your Modem/Router to the internet. (=gateway)
If not available then What is the network address. If your network address is something like:
address: 192.168.0.0
netmask 255.255.255.0
what is your gateway (modem/router)
Lets assume 192.168.0.1
What is your DNS server, lets assume your modem handles that too.

Then:

Either setup the ifcfg-* values or do it for onetime to check...

Assume the one time only:

ifconfig eth0 etc like mentioned before
route add like mentioned before

echo "domain mydomain" >/etc/resolv.conf
echo "nameserver 192.168.0.1" >>/etc/resolv.conf

For manual config DONT restart the network, that would introduce values from the ifcfg-* files.

'cat /etc/resolv.conf '

should show 2 lines.

btw, if one ifcfg-* file exists for an interface please paste it here, I have no Suse
setup so for me thats a wild guess to its contents.

0
 

Author Comment

by:llvllar1on
Comment Utility
i copied all the setting from my windows such DNS , network, ......
i also ping my route ip 192.168.1.1 . it works . but only for my route ip .
from ifconfig and route , i can see my change is matched.  

not work either....
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:llvllar1on
Comment Utility
ifcfg-* file

BOOTPROTO='dhcp ' ------------------------static
BROADCAST =' ' -----------------------192.168.1.255
IPADDR=''-------------------------------192.168.1.5
MTU=''-----------------------------------1500
NAME='Realtek RT8139'
NETMASK= ''----------------------------192.168.1.1
REMOTE_IPADDR=''--------------------192.168.1.1
STARTMODE='auto'
UNIQUE='rBUF.IQxIdihhuH7
USERCONTROL='no'
_nm_name='bus-pci-0000:00:0b.0'


all data in the  side was entered by me.   left side was default
0
 
LVL 1

Expert Comment

by:antoxa
Comment Utility
NETMASK wrong, it won't be like IP address 192.168.1.1, it will be like 255.255.255.0
0
 

Author Comment

by:llvllar1on
Comment Utility
sorry , this was my typo. my setting was 255.255.255.0 for netmask......... i am working fine in dhcp
0
 
LVL 1

Expert Comment

by:antoxa
Comment Utility
please show output of commands:
ifconfig
route -vn
cat /etc/resolv.conf
0
 
LVL 39

Assisted Solution

by:noci
noci earned 150 total points
Comment Utility
Your values are surrounded by ' marks?

Can you ping an address on the internet?
f.e.
ping 194.109.6.66
or try a traceroute
traceroute -n 194.109.6.66

That woulld tell if routing works at the IP layer works. And how far.

can you give the following information:

netstat -rn
cat /etc/resolv.conf


0
 

Author Comment

by:llvllar1on
Comment Utility
finally.  i found i didnot put default gateway. and this command--- route add default gw 192.168.0.1--
only last a while. any one know where to write gateway ?
0
 

Author Comment

by:llvllar1on
Comment Utility
my linux box is suse 10
0
 
LVL 39

Expert Comment

by:noci
Comment Utility
Isn't it this one?

REMOTE_IPADDR=''--------------------192.168.1.1

Otherwise look for a config file with GATEWAY or such in it
'grep GATEWAY /dir/where/ifcfg-*'
0
 

Author Comment

by:llvllar1on
Comment Utility
for noci

both of your suggestions are not work.
0
 

Author Comment

by:llvllar1on
Comment Utility
now every time after I added  --------------route add default gw 192.168.0.1-----------

my network is work.  but i dont want to type every time.
0
 
LVL 24

Accepted Solution

by:
slyong earned 200 total points
Comment Utility
It is inside your /etc/sysconfig/network/routes.  Edit that file and change the line to:

default 192.168.0.1 - -
0
 

Author Comment

by:llvllar1on
Comment Utility
cool. how do you know ---slyong???  i was going to that. but i cannot find this files. in fact, this file (routes) didnot exist in my system.  i will give 100 points for this exact question. looking for answer from anyone!

now the network question is solved . thank you!
0
 
LVL 24

Assisted Solution

by:slyong
slyong earned 200 total points
Comment Utility
llvllar1on,
It is on my SuSE 10.1 also described here http://openskills.info/infobox.php?ID=949.  If the file does not exist, create the file and put in the line:

default 192.168.0.1 - -

also described here http://www.linuxforums.org/forum/suse-linux-help/56290-make-default-gateway-permanent-different-suse-than-red-hat.html
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now