LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-03-2014, 04:02 AM   #1
jackiebaron
Member
 
Registered: Aug 2011
Posts: 51

Rep: Reputation: Disabled
Need to assign static (temp) IP to NIC in Linux Mint


Hi,

I have a Linux Mint 16 laptop and really only use wifi on it. But a situation has arisen where I need to connect via cable to a device and I need to be on the same subnet as that device (it's a wifi router). So I will be disabling my wifi on my laptop.

The device I need to connect to is on the 192.168.0.X net so I must give my NIC an address of say 192.168.0.25. I guess the mask would be 255.255.255.0 and I'm also guessing the default gateway would be 192.168.0.1...or would it? I don't know.

Anyway I just went into Linux Mint's graphic utility to set network settings and set these parameters. I have no cable connected. When I execute ifconfig -a I don't see the IP address assigned to eth0. Do I need to do something else or extra?

Thanks.
 
Old 09-03-2014, 07:22 PM   #2
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 21
This assumes your gateway is at 192.168.0.1 and that you have root access.

From the command line, execute the following:

Code:
ifconfig eth0 192.168.0.25/24
route add -net default gw 192.168.0.1
If you don't have root access, but have sudo privileges, execute the following:

Code:
sudo ifconfig eth0 192.168.0.25/24
sudo route add -net default gw 192.168.0.1
 
Old 09-04-2014, 07:55 AM   #3
qwerewq
LQ Newbie
 
Registered: Mar 2010
Location: Lithuania, Vilnius, Pasilai
Distribution: Debian (testing)
Posts: 27

Rep: Reputation: 0
I think you need to connect cable, make network interface led's blinking.

then check if you have IP:
Code:
/sbin/ip a s
if IP is received over DHCP, just use it
if interface do not have UP in such row: <BROADCAST,MULTICAST,UP,LOWER_UP>
then make it up:
Code:
ip link set dev eth0 up
if IP is not received, use ip command to set it, exec with root:
Code:
ip a add dev eth0 192.168.0.25/24
then you should be able to connect to your wifi device: http://192.168.0.1/
if not add gateway also with root rights:
Code:
ip r add dev eth0 default via 192.168.0.1
I think that's it. If you do not need it to be persistent.

to get root rights just type:
Code:
sudo -s

Last edited by qwerewq; 09-04-2014 at 07:57 AM. Reason: adding additional info to make it more understandable.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I assign a static IP to an interface on a Fedora Linux box? robcast Linux - Newbie 4 03-18-2008 12:37 PM
Howto Assign Multiple Static Public IP Addresses under SBC's PPPoE Static Ip system o trekgraham Linux - Networking 8 04-17-2007 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration