User avatar
rolgiati
Posts: 64
Joined: Wed Jul 18, 2012 8:20 pm

Configuring ethernet

Fri Mar 29, 2013 3:52 pm

Is there a utility for configuring the Ethernet connection, or must it be done by going into the configuration files ?
If the second, which files ?

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Configuring ethernet

Fri Mar 29, 2013 6:38 pm

Its pre setup to use DHCP which suits the majority of systems without configuration. The network configuration on Rasbdian is /etc/network/interfaces .
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
rolgiati
Posts: 64
Joined: Wed Jul 18, 2012 8:20 pm

Re: Configuring ethernet

Fri Mar 29, 2013 6:43 pm

Thanks; my LAN uses fixed IP, so I'll have to vi /etc/network/interfaces ;-3(

And I wont judge Linux, which I have been using since the days Slackware came on umpteen floppies...

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Configuring ethernet

Fri Mar 29, 2013 6:53 pm

General sig. I got a bit fed up of people blaming Linux for the shortcomings the Pi.....
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
rolgiati
Posts: 64
Joined: Wed Jul 18, 2012 8:20 pm

Re: Configuring ethernet

Fri Mar 29, 2013 7:35 pm

Done and it works.

So for the edification of future generations, this is what I did:

I replaced the line
iface eth0 inet dhcp
with
iface eth0 inet static
address 192.168.1.6
netmask 255.255.255.0
gateway 192.168.1.254
broadcast 255.255.255.255

(use your own ip, netmask, gateway and broadcast addresses ;-3)

and rebooted.

gouchout
Posts: 3
Joined: Fri May 18, 2012 9:13 pm

Re: Configuring ethernet

Sat Mar 30, 2013 8:48 pm

Good post - a clear example to follow.
Its straightforward configuration like that which made me fall in love with GNU/Linux (RedHat 6 on a free CD with a book) then I discovered Debian & apt-get, rejected the works of the unholy Ballmer and his minions and became a true believer ;) GUIs are all very well but they are just another thing to go wrong(Network Manager in Gnome is a case in point) IMHO

User avatar
rolgiati
Posts: 64
Joined: Wed Jul 18, 2012 8:20 pm

Re: Configuring ethernet

Mon Apr 08, 2013 2:26 pm

If it may be of use, here is a script that will modify /etc/network/interfaces when run from anywhere ;-3)
Dont know if it should go into the wiki...
Or added to a future release...

Code: Select all

#!/bin/bash
# This script adds the fixed IP address in /etc/network/interfaces
# © Renaud Olgiati 2013 Feel free to copy or modify.

#Check that the script is run as root, if not relaunch with sudo 
  if [ $UID != 0 ]; then
echo "mkinitrd must be run as root."
echo " "
sudo /home/ron/fixed-IP
exit 1
  else 
echo "fixed-IP now running as Root"
echo " "
# Check eth0 is in DHCP mode
  if grep "iface eth0 inet dhcp" interfaces >/dev/null 2>&1; then
# Modify below the addresses for your LAN; if needed ask your network administrator
sed -e '/iface eth0 inet dhcp/a\
address 192.168.1.1\
netmask 255.255.255.0\
gateway $192.168.1.25\
broadcast $255.255.255.255
/iface eth0 inet dhcp/i\
  
s/iface eth0 inet dhcp/iface eth0 inet static/' /etc/network/interfaces > /etc/network/interfaces.tmp
cp -f /etc/network/interfaces.tmp /etc/network/interfaces && rm -f /etc/network/interfaces.tmp
echo Now restarting the network on teh0
echo " "
ifdown eth0 && ifup eth0
  else
echo " "
echo Fixed addresses are already present in the /etc/network/interfaces file;
echo if needed edit with the following command
echo sudo nano /etc/network/interfaces
echo " "
  fi
  fi

BMardle
Posts: 107
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Configuring ethernet

Mon Apr 08, 2013 3:40 pm

Thanks, rolgiati.

Anyone know what packages (if any) need to be installed so I can telnet and ftp to my Pi (says I in a fit of laziness)?
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Configuring ethernet

Mon Apr 08, 2013 4:03 pm

BMardle wrote:Thanks, rolgiati.

Anyone know what packages (if any) need to be installed so I can telnet and ftp to my Pi (says I in a fit of laziness)?
Canonical (nonsensical) answer: Don't do that! Use ssh (& friends) instead!
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
rolgiati
Posts: 64
Joined: Wed Jul 18, 2012 8:20 pm

Re: Configuring ethernet

Mon Apr 08, 2013 4:58 pm

BMardle wrote:Anyone know what packages (if any) need to be installed so I can telnet and ftp to my Pi (says I in a fit of laziness)?
Myself I am partial to Gftp (Gtk-based) and OpenSSH; ssh is much safer than telnet.

BMardle
Posts: 107
Joined: Wed Feb 13, 2013 4:00 pm
Location: Isle of Wight

Re: Configuring ethernet

Mon Apr 08, 2013 7:43 pm

I might need to connect from a Windows machine if I make my Pi unusable. I know that's got telnet and ftp. In the past I've connected to my unusable machines via RS232 but I guess it's time to get a bit more up to date!
Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

penx
Posts: 4
Joined: Sun Apr 21, 2013 5:28 pm

Re: Configuring ethernet

Mon Aug 03, 2015 6:15 pm

Oddly, my ethernet interface wasn't enabled on first boot. Doing 'ifconfig' showed only the local loopback. I had to do the following:

sudo ip link set dev eth1 down
sudo dhclient eth1

Return to “Beginners”