Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I create an eth1 connection with IP address 10.4.6.2, subnet mask 255.255.255.128(/25), with a gateway set as the first available address from the network, and MAC address AA:BB:CC:DD:4:6 .

I need this set up before (pre-up) starting the interface. Additionally, I have to create a file in /var/log/journal which keeps track of every (up and down) state change of the interface (adding the event data at the end of the file).

For example, if I shut down the interface, the file will contain DOWN [8-12-10/17:55:30], with the date written in this format: [day-month-year/hour:minute:second]

share|improve this question

closed as off topic by Bruno Pereira, RolandiXor, jrg Aug 23 '12 at 14:00

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted

First determine if you can do what you want with network manager, from your post I think that is unlikely.

If you are not going to use Network manager, you will need to either remove it or disable it and understand how to manually configure your network.

sudo apt-get remove –purge network-manager network-manager-gnome

Bring the network down

sudo /etc/init.d/networking stop

You would then set your nameserver in /etc/resolv.conf

sudo -e /etc/resolv.conf

You then edit /etc/network/interfaces

sudo -e /etc/network/interfaces

Something like this

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.4.6.2
netmask 255.255.255.128
broadcast 111.222.333.444 #I am not sure of your broadcast
gateway your_gateway)ip

You can then use the up/down options, the syntax is

up <command>

So in your case, add in

up echo $(date) "eth0 up" >>  /var/log/journal
down echo $(date) "eth0 down" >> /var/log/journal

Add those commands in in the eth0 stanza, below gateway.

See http://manpages.ubuntu.com/manpages/oneiric/man5/interfaces.5.html

Likewise, date is very flexible, and the options are covered in the man page

http://manpages.ubuntu.com/manpages/oneiric/man1/date.1.html

date +"%d-%m-%y %l:%M:%S"

That at least is going to get you in the ball park.

share|improve this answer
    
thank you very much. You were of great help:) –  johnny Dec 8 '11 at 18:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.