Community discussions

MikroTik App
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

How to setupu dhcp-client?

Fri Sep 26, 2008 4:32 pm

I setup:

/ip/address:
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE                                                     
 0   192.168.1.1/24     192.168.1.0     192.168.1.255   Local                                                         
 1 D 92.52.11.46/24     92.52.11.0      92.52.11.255    Internet 
/ip/route/print detail:
[admin@MikroTik] /ip route> print detail
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 0  DS  dst-address=0.0.0.0/0 gateway=92.52.11.1 interface="" gateway-state=unreachable distance=0 scope=30 
        target-scope=10 

 1 ADC  dst-address=92.52.11.0/24 pref-src=92.52.11.46 interface=Internet distance=0 scope=200 

 2 ADC  dst-address=192.168.1.0/24 pref-src=192.168.1.1 interface=Local distance=0 scope=10 
/ip/firewall/nat/print:
Flags: X - disabled, I - invalid, D - dynamic 
 0   chain=srcnat action=accept src-address=192.168.1.0/24 

 1   chain=srcnat action=masquerade src-address=192.168.1.0/24 
Internet doesnt work on my pc with ip: 192.168.1.5 and also doesnt work pinging/in winbox - tools- ping/ from mikrotik/192.168.1.1 to my PC/192.168.1.5.
I dont understand why.
It is first time I use dhcp-client, on other routers I use static ip and there there is no problem to nat that, but with dynamic ip of my internet provider I have problem.

Please could you help what is the problem?
 
Pilgrim
Member Candidate
Member Candidate
Posts: 265
Joined: Sun Mar 30, 2008 1:04 pm

Re: How to setupu dhcp-client?

Fri Sep 26, 2008 6:36 pm

To set up the DHCO Client I did the following.


Dynamic IP - no login / password required

/ interface enable ether1
/ ip dhcp-client add interface=ether1 disabled=no

or Dynamic IP login required (PPPoE)

/ interface enable ether1
/ interface pppoe-client add interface=ether1 user="loginmail" password="password"
/ interface pppoe-client add-default-route=yes use-peer-dns=yes disabled=no

There is a very good desription here

http://wiki.mikrotik.com/wiki/How_to_Co ... _xDSL_Line


To set up the whole thing I did as listed in below, but I am still missing a lot of work on the firewall. If anyone could help me here I would be very glad.



Best regards, Pilgrim



++++++ setting up a routerboard minirouter ad a standard home router 1wan/4lan ports +++++++++++++++++

Setup WAN Port (Interface ether 1 as wan connection)

Depending on the provider the wan connection may need to be specified in different ways. Here are the two most
common.

Dynamic IP - no login / password required

/ interface enable ether1
/ ip dhcp-client add interface=ether1 disabled=no

or Dynamic IP login required (PPPoE)

/ interface enable ether1
/ interface pppoe-client add interface=ether1 user="loginmail" password="password"
/ interface pppoe-client add-default-route=yes use-peer-dns=yes disabled=no




Setup LAN ports (interface ether2 through ether5 as LAN ports)

/ interface enable ether2,ether3,ether4,ether5
/ interface bridge add name="LAN" disabled=no
/ interface bridge port add interface=ether2 bridge=LAN
/ interface bridge port add interface=ether3 bridge=LAN
/ interface bridge port add interface=ether4 bridge=LAN
/ interface bridge port add interface=ether5 bridge=LAN


Setup of a DHCP-Server fot the local network with the IP range 192.168.0.50 to 192.168.0.200

/ ip pool add name=dhcp-pool ranges=192.168.0.50-192.168.0.200
/ ip dhcp-server network add address=192.168.0.0/24 gateway=192.168.0.1
/ ip dhcp-server add interface=ether1 address-pool=dhcp-pool



Configure firewall to protect your router:

/ ip firewall filter
add chain=input connection-state=established comment="Accept established connections"
add chain=input connection-state=related comment="Accept related connections"
add chain=input connection-state=invalid action=drop comment="Drop invalid connections"
add chain=input protocol=udp action=accept comment="UDP" disabled=no
add chain=input protocol=icmp limit=50/5s,2 comment="Allow limited pings"
add chain=input protocol=icmp action=drop comment="Drop excess pings"
add chain=input in-interface=ether2 src-address=192.168.0.0/24 comment="From our LAN" action=accept
add chain=input action=log log-prefix="DROP INPUT" comment="Log everything else"
add chain=input action=drop comment="Drop everything else"
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

Re: How to setupu dhcp-client?

Fri Sep 26, 2008 7:15 pm

There is no password needed to make internet connection working. Just dhcp-client. I dont know what can be wrong setted up. Everything seems fine.
 
Pilgrim
Member Candidate
Member Candidate
Posts: 265
Joined: Sun Mar 30, 2008 1:04 pm

Re: How to setupu dhcp-client?

Fri Sep 26, 2008 9:32 pm

I am a newbie and already in over my head trying to set up my own router :-)

The routing seems very complicated and I don't even can try to understand what is all in there. But, have you tried the very impel version as descriped in the quick setup guide, just to see if that works?

after having defined the interfaces

/interface print
/interface set 0 name=Internet; set 1 name=Local
/interface enable Internet, Local
/ip address add address=92.52.11.46/24 interface=Internet
/ip address add address=192.168.1.1/24 interface=Local

You should only need

/ip firewall nat add chain=srcnat action=masquerade out-interface=Internet
/ip route add gateway=92.52.11.1

rgs Pilgrim
 
Pilgrim
Member Candidate
Member Candidate
Posts: 265
Joined: Sun Mar 30, 2008 1:04 pm

Re: How to setupu dhcp-client?

Fri Sep 26, 2008 9:36 pm

Sorry, I forgot about the dhcp client, so I guess it would like this instead:

/interface print
/interface set 0 name=Internet; set 1 name=Local
/interface enable Internet, Local
/ip dhcp-client add interface=Internet disabled=no
/ip address add address=192.168.1.1/24 interface=Local

You should only need

/ip firewall nat add chain=srcnat action=masquerade out-interface=Internet
/ip route add gateway=92.52.11.1

rgs Pilgrim
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

Re: How to setupu dhcp-client?

Fri Sep 26, 2008 10:03 pm

I need to write that gateway there manually, it seems that it was setted up automatically using dhcp-client or not?
 
Pilgrim
Member Candidate
Member Candidate
Posts: 265
Joined: Sun Mar 30, 2008 1:04 pm

Re: How to setupu dhcp-client?

Fri Sep 26, 2008 11:37 pm

Good point. I am not sure. But it needs to be there.

Try not to add the line and use winbox to check if the router had received an IP and a gateway - and not to forget - check also that the router have received a DNS

It could in fact be the the router does have connection to tthe internet, but can't find anything if the DNS is missing.

rgs Pilgrim
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

Re: How to setupu dhcp-client?

Sat Sep 27, 2008 9:44 am

It seems that everything related to internet connection is setted up right using dhcp-client. Also DNS. I dont understand why I cant ping using /tools/ping any internet site. Also I cant ping pc connected to routerboard with ip 192.168.1.5.
 
User avatar
hilton
Long time Member
Long time Member
Posts: 634
Joined: Thu Sep 07, 2006 5:12 pm
Location: Jozi (aka Johannesburg), South Africa

Re: How to setupu dhcp-client?

Sun Sep 28, 2008 12:24 am

You need to change your NAT rule to something like this;

chain=srcnat action=masquerade out-interface=whatever_you_called_your_internet_connection

Hope this helps.
 
Pilgrim
Member Candidate
Member Candidate
Posts: 265
Joined: Sun Mar 30, 2008 1:04 pm

Re: How to setupu dhcp-client?

Sun Sep 28, 2008 2:51 pm

I agree with Hiltin. It must be like that. I suggest to backup your current configuration and reset the router and start all over.

My experience is that it is really easy to make mistakes using the winbox to set up router. If don't know why, but it just seems that it is not so "beginner proof" as using the terminal.

I suggest after having reset the router use winbox or the terminal to enable and rename the two interfaces that you want to use and name them "Internet" and "Local" again - at this time do not enter any IP range / addresses, just enable and rename the interfaces you want to use.

then start up winbox and click new terminal and simply copy and paste (right click) the following line into the terminal.

/ip dhcp-client add interface=Internet disabled=no
/ip address add address=192.168.1.1/24 interface=Local
/ip firewall nat add chain=srcnat action=masquerade out-interface=Internet

After that there should be connection.

rgs Pilgrim
 
Pilgrim
Member Candidate
Member Candidate
Posts: 265
Joined: Sun Mar 30, 2008 1:04 pm

Re: How to setupu dhcp-client?

Sun Sep 28, 2008 2:54 pm

PS. what harware are you using?

the PC 192.168.1.5 is this PC connect through a switch together with the other PC's to the one interface called Local?

rgs Pilgrim
 
radocicala
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Aug 10, 2007 6:56 pm

Re: How to setupu dhcp-client?

Thu Oct 02, 2008 11:47 pm

The reason why it didnt worked were two tick in ip/dns/settings. Now everything works great, THANKS FOR HELP
Also it couldnt be done using terminal, I coul call it bug of ROS v3

Who is online

Users browsing this forum: GoogleOther [Bot] and 101 guests